CareerTop Question 1
Data Structures - Arrays and Strings:
Implement an algorithm to determine if a string has all unique characters. What if you can not use additional data structures?
My Original Solution:
private static boolean isUniqueStr(String str) {int checker = 0;for (int i = 0; i < str.length(); i++) {int val = str.charAt(i) - 'a';if ((checker & (i << val)) > 0) {return false;}checker |= (1 << val);}return true;}
?
Have no idea about how to check unique string without any data structure.