Single Number

Bit manipulation · Use XOR cancellation · Easy · about 16 min

Why it matters

Bit manipulation looks unfamiliar, but a few identities solve classic interview questions cleanly.

How it connects

This is a compact tool in your kit: identical values can cancel with one bitwise operation.

Try first

Try XOR on the same number twice. What happens?

Interview cue

XOR is associative and cancels pairs, so one pass and constant space are enough.