« first day (1493 days earlier)      last day (935 days later) » 

ASR
2:13 PM
public static boolean  checkUnique(String str){

		boolean[] strSet = new boolean[256];//boolean array representing each character in char set

		for(int i = 0; i<str.length(); i++){

			int val = str.charAt(i);//we assign a character to an int so its ASCII value gets stored..!

			System.out.println(val);

			if(strSet[val]){ //if its already true
				return false; //we have a duplicate
			}
			strSet[val] = true; //set boolean value representing that character to be true
		}
		return true; // all characters in string was unique..!
 
Xeo
1 message moved from Lounge<C++>
 

« first day (1493 days earlier)      last day (935 days later) »