Topics / Bit Manipulation
💡
Bit Manipulation
AND, OR, XOR, shifts, and the little tricks (n & -n, n & (n-1)) that win interviews.
Why learn Bit Manipulation?
-
Tiny topic, big interview signal.
-
Unlocks elegant O(1) solutions to specific problems.
-
A required tool for low-level and systems work.
What you can build with Bit Manipulation
Single-number (XOR) family Bitmask DP Low-level system flags and permissions
Bit Manipulation tutorials
2 articles · page 1 of 1Hand-written tutorials, ordered as a recommended learning path.
- 01 Missing Number Solve the Missing Number problem with three approaches: hashing, Gauss sum formula, and XOR. Includes complexity analysis and interview tips.
- 02 Single Number Solve the Single Number problem in O(n) time and O(1) space using XOR. Includes a walkthrough, edge cases, and follow-up variants.