British mathematician George Boole
Answer:
import java.util.*;
public class work {
// function for counting unique character
public static int numUnique(String input) {
boolean[] list = new boolean[Character.MAX_VALUE];
for (int i = 0; i < input.length(); i++) {
list[input.charAt(i)] = true;
}
int count = 0;
for (int i = 0; i <list.length; i++) {
if (list[i] == true){
count++;
}
}
return count;
}
public static void main(String args[])
{
List<String>list=new ArrayList<>(); // creatng array list of type string
list.add("abcdef");
list.add("aaabcd");
list.add("bccddee");
list.add("abcddd");
list.add("a");
for(String str:list)
{
// for printing the results
System.out.println("given string : "+ str+" , number of unique values :"+numUnique(str));
}
}
}
Explanation:
def func():
money = int(input("How much money will you have on holiday? "))
print("You will have {} euros.".format(int(money * 1.11)))
money = int(money * 1.11)
fifty = 0
twenty = 0
ten = 0
five = 0
while True:
if money - 50 >= 0:
fifty += 1
money -= 50
elif money - 20 >= 0:
twenty += 1
money -= 20
elif money - 10 >= 0:
ten += 1
money -= 10
elif money - 5 >= 0:
five += 1
money -= 5
if money < 5:
print("You will have {} fifties, {} twenties, {} tens, {} fives, and {} ones".format(fifty, twenty, ten, five, money))
return
func()
I hope this helps!
Answer:
B. R is NP Hard
Explanation:
Given:
S is an NP complete problem
Q is not known to be in NP
R is not known to be in NP
Q is polynomial times reducible to S
S is polynomial times reducible to R
Solution:
NP complete problem has to be in both NP and NP-hard. A problem is NP hard if all problems in NP are polynomial time reducible to it.
Option B is correct because as given in the question S is an NP complete problem and S is polynomial times reducible to R.
Option A is not correct because R is not known to be in NP
Option C is not correct because Q is also not known to be in NP
Option D is not correct because Q because no NP-complete problem is polynomial time reducible to Q.