Advanced Bit Manipulation Problems for Coding Interviews
25 advanced Bit Manipulation problems from real coding interviews, each with test cases you can run online. By difficulty they split into 0 basic, 0 intermediate and 25 advanced. The companies that ask them most often are Amazon, Google, Apple, Doordash.
Solve a few problems of each level, name the pattern after each one and revisit the ones that needed a hint a week later. Practise stating the time and space complexity and the edge cases before you code.
Coding problems
- Count Equal XOR Triplets (Advanced)
- Maximum XOR Pair Under Limit (Advanced)
- IP Longest Prefix Match (Advanced)
- Exact Cover Solver (Advanced)
- Integers Without Consecutive Ones (Advanced)
- Basic Calculator (Advanced)
- Minimum AND Cost Walk (Advanced)
- Minimum XOR Sum of Two Arrays (Advanced)
- Parse Lisp Expression (Advanced)
- Basic Calculator III (Advanced)
- XOR Sum of All Pairs Bitwise AND (Advanced)
- Decode XORed Permutation (Advanced)
- Count Subarrays With Bitwise AND Equal to K (Advanced)
- N-th Number With Exactly K Set Bits (Advanced)
- Count Numbers Up To N With K Set Bits (Advanced)
- Maximum Subset XOR (Advanced)
- Number of Distinct Subset XOR Values (Advanced)
- Count Subsets With Zero AND (Advanced)
- Submask Sum Transform (Advanced)
- Clock Page Replacement Faults (Advanced)
- Maximum XOR of Any Subarray (Advanced)
- Subsets With XOR Equal to K (Advanced)
- Sum of OR Over All Subarrays (Advanced)
- Sum of AND Over All Subarrays (Advanced)
- Maximum XOR With Query Value (Advanced)
Related
Frequently asked questions
How do I get good at bit manipulation problems?
Practise by level, name the pattern after you solve each problem and review the ones you needed hints for. The list is ordered so you can start with the basic ones.
Can I run bit manipulation problems online here?
Yes. Each problem opens in an editor that runs your code against test cases in Java, Python, C++, Go, JavaScript and more.