https://leetcode.com/problems/find-the-difference/
Solution 1
/**
* @param {string} s
* @param {string} t
* @return {character}
*/
var findTheDifference = function (s, t) {
if (s.length === 0) {
return t;
}
const orderedS = s.split('').sort();
const orderedT = t.split('').sort();
for (let i = 0; i < t.length; i++) {
if (orderedS[i] !== orderedT[i]) {
return orderedT[i];
}
}
};