Skip to content

Instantly share code, notes, and snippets.

@Howiezhang226
Last active August 29, 2015 14:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Howiezhang226/0d0c0a2a92ea07c1fa19 to your computer and use it in GitHub Desktop.
Save Howiezhang226/0d0c0a2a92ea07c1fa19 to your computer and use it in GitHub Desktop.
cc150
/**
* created by howie zhang
* 2015/3/31
* cc150 1.1
*/
public class Solution {
public boolean isUnique(String s) {
if (s.length() > 256)
return false;
boolean[] all = new boolean[256];
for (int i = 0; i < s.length(); i++) {
int pos = s.charAt(i);
if (all[pos])
return false;
else
all[pos] = true;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment