1.1
//Implement an algorithm to determine if a string has all unique characters.
//What if you cannot use additional data structures?
package com.careercup.chapter1;
public class CareerCup_1_1 {
public static boolean IsUnique(String a){
for(int i= 0; i<a.length(); i++){
for(int j = i+1; j <a.length(); j++ ){
if (a.charAt(i) == a.charAt(j)){
return false;
}
}
}
return true;
}
public static void main(String args[]){
String a = "weixiaochen";
if (IsUnique(a) == false){
System.out.println("not unique");
}
else System.out.println("unique");
}
}