Palindrome Permutation

给一个字符串, 问他的随意组合能否组成一个回文. 回文就是里面的字符是偶数或者只有一个奇数.

class Solution {
    public boolean canPermutePalindrome(String s) {
        int[] count = new int[512];
        for(char c : s.toCharArray()) {
            count[c] ++;
        }
        int odd = 0;
        for(int n : count){
            if(n % 2 != 0)
                odd++;
        }
        return odd <= 1;
    }
}