javascript solution


  • 0
    W

    var findTheDifference = function(s, t) {
    if(!s){
    if(t){
    return t;
    }
    }
    var temp = t.length,
    temp1 = s.length,
    brr,
    arr;
    for(var i = 0; i < temp; i++){
    for(var j = 0; j < temp1; j++){
    if(s.charAt(j) === t.charAt(i)){
    arr = t.split('');
    arr.splice(i, 1);
    brr = s.split('');
    brr.splice(j, 1);
    t = arr.join('');
    s = brr.join('');
    }
    }
    }
    return t;
    };


Log in to reply
 

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