Easy understand 4 line C++ Solution


  • 0
    F

    class Solution {
    public:
    bool canPermutePalindrome(string s) {
    unordered_map<char,int>mp;
    int cc=0;
    for(int i=0;i<s.length();i++) ++mp[s[i]]%2==1? cc++:cc--;
    return cc<2;
    }
    };


Log in to reply
 

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