You are given two strings s and t. String t is generated by random shuffling string s and then adding one more letter at a random position. Return the letter that was added to t.
s = "abcd", t = "abcde""e"s = "", t = "y""y"XOR is commutative and associative. x ^ x = 0, x ^ 0 = x. XOR-ing all chars of both strings leaves only the extra char since all others appear twice and cancel. Order does not matter — even though t is a shuffled version of s with one extra char, XOR-ing everything together causes every paired character to self-cancel, leaving only the lone extra character.