Multiset----My C++ ac code


  • 0
    Z
    bool isAnagram(string s, string t) {
      
       multiset<char> set_s;
        for(int i = 0; i < s.size(); i ++)
            set_s.insert(s[i]);
            
        multiset<char>  set_t;
        for(int j = 0; j < t.size(); j ++)
            set_t.insert(t[j]);
            
        return set_s==set_t;
    }

Log in to reply
 

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