Re:Stack Overflow: the Blind Leading the Blind
by sah on Sunday August 31, 2008 @09:35PM
(#291635)
Iterate through the list bitwise-XORing the numbers together into an accumulator. Because x ^ x = 0, and x ^ 0 = x, and ^ is commutative (x ^ y = y ^ x), the final value in the accumulator for a list like [x, y, y, x, z] is:
[ Parent
| on HN ]
There are no comments on this comment yet.