1-liner C++, multiset


  • 0
    bool isAnagram(string s, string t) {
        return multiset<char>(begin(s), end(s)) == multiset<char>(begin(t), end(t));
    }
    

    Unfortunately with 244 ms it's super slow :-)


Log in to reply
 

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