87. Single Number

Every element appears twice except one. Find that one in O(n) time and O(1) extra space.

Example 1

Input: nums = [2,2,1]
Output: 1

Example 2

Input: nums = [4,1,2,1,2]
Output: 4
Hint 1

XOR of a number with itself is 0.

Bit Manipulation