Problems › Topics › Bit manipulation
Bit manipulation practice problems
Work on the bits themselves — flags, masks, powers of two. A pattern: a move you make, and the kind of thing an interview is really asking you to spot. 9 problems in the bank train it, each with a worked example, a hint and a reference solution.
Start a Bit manipulation session →
- Math
- Strings
- Arrays
- Hash maps
- Sorting
- Parsing
- Two pointers
- Sliding window
- Prefix sums
- Stacks
- Binary search
- Intervals
- Grids
- Greedy
- Recursion
- Simulation
- Bit manipulation
9 problems
- Is it a power of twoeasy
- Count the set bitseasy
- Exponential backoff with a ceilingeasy
- How many hosts fit in a CIDR blockeasy
- Does this account hold every righteasy
- Write the field out in binaryeasy
- How many switches differeasy
- The reading that only came oncemedium
- Which is the lowest flag switched onmedium