Single Number III - Approach

1.1. XOR all elements. Result is aba \oplus b where aa and bb are the two unique numbers.

2.2. Find any set bit in this XOR (the rightmost is easiest: xor & (-xor)).

3.3. This bit differs between aa and bb. Partition all numbers by this bit.

4.4. XOR within each group. One group gives aa, the other gives bb.