Two lines of C++ code with stl multiset


  • 2
    J
    bool isAnagram(string s, string t) {
            multiset<char> msc1(s.begin(), s.end());
            multiset<char> msc2(t.begin(), t.end());
            return msc1==msc2;
    }
    

Log in to reply
 

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