Given a string, determine if a permutation of the string could form a palindrome. Example 1: Input: "code" Output: false Example 2: Input: "aab" Output: true Example 3: Input: "carerac" Output: true class Solution { public boolean canPermutePalindrome(String s) { // palindrome, only one or zero odd freq of chars int[] array = new int[128]; for(char c : s.toCharArray()){ array[c]++; } int numOdd = 0; for(int num : array){ if(num % 2 == 1){ numOdd++; if(numOdd > 1) return false; } } return true; } } // new int[28], x - 'a', the distance from a lower case letter to 'a' // same applies to upper class letters // new int[128], use char's integer value to find its bucket , no distance involved here, so no need to // do the difference math as above