AAlgoLoopSpaced repetition for LeetCode

Bit Manipulation

Bit manipulation operates directly on a number's binary representation with AND, OR, XOR, and shifts to gain speed or O(1) space. XOR's self-cancelling property, bitmasks for subsets, and the 'n & (n-1)' trick are the recurring tools.

10 LeetCode problems solved with the Bit Manipulation pattern. Practice them with spaced repetition so the pattern sticks.

See the full solution

The complete approach, reference solutions in 5 languages, and a step-by-step visualization — then add this problem to your spaced-repetition schedule.

Start free →