Share my JavaScript solution


  • 1
    P
    var isAnagram = function(s, t) {
        s = s.split('').sort().join('')
        t = t.split('').sort().join('')
        if(s.length !== t.length){
            return false
        }
        for(let i=0;i<s.length;i++){
            if(s[i] !== t[i]){
                return false
            }
        }
        return true
    };

Log in to reply
 

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