Comment

Comment by twiceaday

How about every value appears 0 mod n times except one which appears 1 mod n times? :)

Solution: xor is just addition mod 2. Write the numbers in base n and do digit-wise addition mod n (ie without carry). Very intuitive way to see the xor trick.

parent twiceaday 6 months ago

No comments yet

Be the first to share your thoughts.

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton