Game of Thrones - I

  • + 0 comments

    My C++ Solution:

    string gameOfThrones(string s) {
        map<char,int> mp;
        for(int i=0;i<s.size();i++){
            mp[s[i]]++;
        }
        int count=0;
        for (const auto& pair : mp) {
            if(pair.second % 2 ==1){
                count++;
            }
            if(count>=2){
                return "NO";
            }
        }
        return "YES";
    }