Last active
August 29, 2015 14:18
-
-
Save Howiezhang226/0d0c0a2a92ea07c1fa19 to your computer and use it in GitHub Desktop.
cc150
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* 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