Coding & Algorithms (DSA)
Bit Manipulation
6 practice questions. Free questions open a full answer guide; the rest unlock with Pro.
- What does the expression n & (n - 1) do at the bit level, and what problems does that one operation let you solve cheaply?
- How would you count the number of 1-bits in an integer's binary representation efficiently, and what makes the trick faster than checking every bit?Go Pro
- Explain the XOR trick that finds the single non-repeated number in an array where every other value appears twice, and why you'd reach for bit manipulation here instead of a hash set.Go Pro
- If an array has every number appearing exactly twice except one that appears once, how would you find the single number using O(1) extra space, and why does it work?Go Pro
- A teammate uses bit manipulation to micro-optimize hot code: bit flags for a permission set, n & (n-1) to count set bits, and left-shifts for multiplication. Where do these techniques genuinely pay off, and what are the correctness traps you'd flag in review?Go Pro
- In an array where every value appears twice except one, why does XORing everything together find the single value, and where does that trick stop working?Go Pro
Want questions matched to your role? Paste a job title, job description, or CV for a personalized set, or go Pro to unlock the full bank.