Dsa
Bit Manipulation
Warm-up
Flipping Bits
Given an unsigned 32-bit integer N, return the value of N with all bits flipped.
Input format:
- A single integer N (0 <= N <= 2^32 - 1)
Output format:
- A single integer with all bits flipped.
Example:
Input:
5
Output:
4294967290
(Note: 5 in binary is '00000000000000000000000000000101'. Flipping gives '11111111111111111111111111111010', which is 4294967290.)
Key concepts
bit manipulationinversion
Practise this out loud — free
Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.
🎙 Practise this question now