XOR has properties that make it incredibly useful:
(a number XORed with itself is 0)
(XORing with 0 does nothing)
XOR is commutative and associative:
These properties let you find unique elements, detect duplicates, and even swap variables without a temporary. If you XOR all numbers in a list where every number appears twice except one, the pairs cancel out () and only the unique number remains.