Question
Given an array of integers, every element appears twice except for one. Find that single one.
Bit Manipulation
Note that a XOR a = 0
. Therefore, if the element exist twice, the XOR would be 0 so that only the single one remains.
- Time Complexity: O(n)
- Space Complexity: O(1)