Slow but simple solution


  • 0
    V
    class Solution {
    public:
        bool isAnagram(string s, string t) {
            if( s.size() != t.size() )
                return false;
        
            sort( s.begin(), s.end() );
            sort( t.begin(), t.end() );
            return s == t;
        }
    };

Log in to reply
 

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