Problems > Two Lonely Numbers > Editorial

Two Lonely Numbers — Solution & Editorial

Back to the Problem

XOR of everything equals x⊕y, which is non-zero; pick any set bit of it (the lowest works) and split the array by that bit — each part contains exactly one singleton, recoverable by XOR.

Complexity: O(N)