Problems > The Lonely Number > Editorial

The Lonely Number — Solution & Editorial

Back to the Problem

XOR everything: pairs cancel (x ⊕ x = 0), leaving the singleton.

Complexity: O(N) time, O(1) memory