public boolean canPermutePalindrome(String s) {
        if(s.length()<=1)return true;
        Set<Character> set= new HashSet<>();

        for(int i=0; i<s.length(); i++){
            char c=s.charAt(i);
            if(!set.contains(c))
                set.add(c);
            else
                set.remove(c);
        }
        return set.size() <=1;
    }
To be palindrome, string needs to have even number of the same characters and/or single character.
src/problems/easy/PalindromePermutation.java