javascript solution


  • 0
    E

    This is javascript solution:

    var findTheDifference = function(s, t) {
        const len = t.length;
        let c = t.charCodeAt(len - 1);
        
        for (let i = 0; i < len - 1; i++) {
        	c ^= (s.charCodeAt(i));
        	c ^= (t.charCodeAt(i));
        }
        
        return String.fromCharCode(c);
    };
    

Log in to reply
 

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