Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Solustion {
- public static boolean IsUnique(String s) {
- if (s == null) {
- return true;
- }
- if (s.length() > 256) {
- return false;
- }
- boolean[] asciiExist = new boolean[256];
- for (int i = 0; i < s.length(); i++) {
- int index = s.charAt(i);
- System.out.println(index+"!!!");
- if (asciiExist[index]) {
- return false;
- }
- asciiExist[index] = true;
- }
- return true;
- }
- public static void main(String[] args){
- System.out.print(Solution.IsUnique("2irdf329r52ql"));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement