266. Palindrome Permutation

    /*
     *266. Palindrome Permutation
     *2016-6-24 by Mingyang 
     *这个题目很简单的是HashSet来做,遇到一样的,就remove,从没出现的就Add
     */
    public boolean canPermutePalindrome1(String s) {
        Set<Character> set=new HashSet<Character>();
        for(int i=0; i<s.length(); ++i){
            if (!set.contains(s.charAt(i)))
                set.add(s.charAt(i));
            else 
                set.remove(s.charAt(i));
        }
        return set.size()==0 || set.size()==1;
    }
原文地址:https://www.cnblogs.com/zmyvszk/p/5615833.html