Tech_Interview_Prep

Bit Manipulation

Working directly on a number's binary representation with AND/OR/XOR/shifts — for O(1) tricks and memory-efficient state.

Q1.What does the expression `n & (n - 1)` do to the binary representation of n?

Q2.What is the result of `x XOR x` for any integer x?

Q3.What common bitwise trick finds the single non-duplicated number in an array where every other number appears exactly twice?

Q4.What does a left shift `x << 1` do to the value of x?