Remember
- x xor x = 0 and x xor 0 = x. Commutative and associative, so pairs cancel wherever they sit.
- Single number: XOR everything. Missing number: XOR what should be there against what is.
- The XOR swap works, but a temporary variable is clearer and no slower. Know the trick, do not ship it.