- Use hash table is straightforward.
charinto ASCII code, then XOR them all together. The extra
charwill be left because the number of every char excep the extra is
even, which make
charCode ^ charCode === 0. And
0 ^ extraCharCode === res
You are given two strings
t is generated by random shuffling string
s and then add one more letter at a random position.
Return the letter that was added to
Input: s = "abcd", t = "abcde"
HashTable with O(n) space
Bitwise with O(1) space