Java 3 lines beats 75%


  • 0
    M
        public boolean canPermutePalindrome(String s) {
            BitSet bs = new BitSet(128);
            for(int i = 0; i < s.length(); i++) bs.flip(s.charAt(i));
            return bs.cardinality() <= 1;
        }
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.