Question4 determine wheter a string contain unique characters
// Some code
boolean isUnique(String a) {
HashSet<Character> set = new HashSet<>();
for (int i = 0; i < a.length(); i++) {
char c = a.charAt(i);
if (set.contains(c)) {
return false;
}
set.add(c);
}
return true;
}PreviousQuestion3 What happens if we assign a negative number to an unsigned integerNextQuestion 5 How to reverse all bits of a number?
Last updated