String has all unique characters
//Implement an algorithm to determine if a string has all unique characters. What if you cannot use additional data structures?
import java.util.Arrays;
class Main {
public static void main(String[] args) {
System.out.println(isUnique("ABCDEFGIJKLMNOPQRSTWXYZ"));
/*
*/
}
public static boolean isUnique(String str){
if(str == null && str.length() == 0){
return false;
}
char tempArray[] = str.toCharArray();
Arrays.sort(tempArray);
for(int i=1;i<tempArray.length;i++){
if(tempArray[i] == tempArray[i-1]){
return false;
}
}
return true;
}
}INFO