(String str)
| 16 | } |
| 17 | |
| 18 | public static boolean isUniqueChars2(String str) { |
| 19 | if (str.length() > 128) { |
| 20 | return false; |
| 21 | } |
| 22 | boolean[] char_set = new boolean[128]; |
| 23 | for (int i = 0; i < str.length(); i++) { |
| 24 | int val = str.charAt(i); |
| 25 | if (char_set[val]) return false; |
| 26 | char_set[val] = true; |
| 27 | } |
| 28 | return true; |
| 29 | } |
| 30 | |
| 31 | public static void main(String[] args) { |
| 32 | String[] words = {"abcde", "hello", "apple", "kite", "padle"}; |