14 worked problems

Bit Manipulation

XOR tricks, masks, and shifting instead of arithmetic. Parity, subsets, powers of two, or pair cancellation can be represented directly by bits.

Recognition signal

When should you think of Bit Manipulation?

Parity, subsets, powers of two, or pair cancellation can be represented directly by bits.

Core invariant

What must stay true?

Each processed bit position contributes independently or the XOR accumulator preserves unmatched values.

Practice in a deliberate order

What to learn in this cluster

  1. 01Masks and bit counts
  2. 02XOR cancellation
  3. 03Subset masks and bitwise tries

All Bit Manipulation problems

14 of 14 walkthroughs
Continue the cluster

Related patterns and study guides