LeetEye LeetEye
Cheat Sheet

Bit Manipulation Cheat Sheet

Quick reference for coding interviews. Bookmark this page!

What is Bit Manipulation?

Leverage binary operations for space and time efficiency.

Trigger Words

When you see these in a problem, think Bit Manipulation:

single number bit-manipulation number of 1 bits counting bits reverse bits missing number sum of two integers reverse integer

Template Code

def singleNumber(nums: List[int]) -> int:
    result = 0
    for num in nums:
        result ^= num
    return result

Complexity

Typical Time O(n)
Typical Space O(1)

Common Variations

  • Basic Bit Manipulation
  • Bit Manipulation with constraints
  • Optimized Bit Manipulation

Practice Problems

See all Bit Manipulation problems →

Practice Bit Manipulation

Learn to recognize patterns instantly with interactive MCQs.

Download LeetEye Free
Practice in LeetEye