Advertisement
Guest User

Untitled

a guest
Dec 19th, 2014
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. public class Solustion {
  2. public static boolean IsUnique(String s) {
  3. if (s == null) {
  4. return true;
  5. }
  6. if (s.length() > 256) {
  7. return false;
  8. }
  9.  
  10. boolean[] asciiExist = new boolean[256];
  11. for (int i = 0; i < s.length(); i++) {
  12. int index = s.charAt(i);
  13. System.out.println(index+"!!!");
  14. if (asciiExist[index]) {
  15. return false;
  16. }
  17. asciiExist[index] = true;
  18. }
  19. return true;
  20.  
  21. }
  22. public static void main(String[] args){
  23.  
  24. System.out.print(Solution.IsUnique("2irdf329r52ql"));
  25.  
  26. }
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement