# Leetcode 389 - Find the diff

`Note:`

- Use hash table is straightforward.
- Use
`XOR`

operation. Convert`char`

into ASCII code, then XOR them all together. The extra`char`

will be left because the number of every char excep the extra is`even`

, which make`charCode ^ charCode === 0`

. And`0 ^ extraCharCode === res`

`Question:`

You are given two strings `s`

and `t`

.

String `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 `t`

.

`Example:`

1 | Input: s = "abcd", t = "abcde" |

`Code:`

`HashTable with O(n) space`

1 | /** |

`Bitwise with O(1) space`

1 | /** |