Single Number - XOR Properties

XOR has two key properties: 1.1. aa=0a \oplus a = 0 (self-inverse).

2.2. a0=aa \oplus 0 = a (identity).

XOR all elements. Pairs cancel out (aa=0a \oplus a = 0), leaving only the unique element.

Example: 41212=4(11)(22)=400=44 \oplus 1 \oplus 2 \oplus 1 \oplus 2 = 4 \oplus (1 \oplus 1) \oplus (2 \oplus 2) = 4 \oplus 0 \oplus 0 = 4.