Use XOR properties:
- (anything XORed with itself is 0).
- (anything XORed with 0 is itself).
- XOR is commutative and associative.
XOR all numbers together. Pairs cancel out (become 0). The single number remains.
The core idea
Use XOR properties:
XOR all numbers together. Pairs cancel out (become 0). The single number remains.