Javascript solution by using `replace`


  • 0
    A
    var findTheDifference = function(s, t) {
        var arr = s.split('');
        for(var i = 0; i < arr.length; i++){
            t = t.replace(arr[i],'')
        }
        return t;
    };
    

Log in to reply
 

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