Guided lesson

Bit Manipulation Basics

Problem Solving

Bit Manipulation Basics

Core

Mental model

  • AND, OR, XOR, shift are the key operators.

Operations

set bit

Cost shape

Usually O(1) per operation

Watch out

Operator precedence mistakes.

Related algorithms

Subsets with BitmaskSingle Number
Guided progression
10% lesson
Step 1 / 2Learner goal
Speech settings Speed 1.0 · Volume 90%

Keyboard: Space play/pause · Arrow keys step · Page Up/Down change sections · R restart