Open pwstrick opened 4 years ago
389. 找不同
/** * @param {string} s * @param {string} t * @return {character} */ var findTheDifference = function(s, t) { const len1 = s.length, len2 = t.length; let one = 0; for(let i=0; i<len1; i++) { one ^= (s[i].charCodeAt() ^ t[i].charCodeAt()) } one ^= t[len2 - 1].charCodeAt(); return String.fromCharCode(one); };
389. 找不同