Question bank › Bit Manipulation
Dsa Bit Manipulation Hard

Bit Flipper

Write a function that flips the bits of an integer. The function should read an integer input and print the integer resulting from flipping all its bits (turning all 0s to 1s and vice versa). Example: Input: 5 Output: -6 Explanation: The binary representation of 5 is 0000 0101. Flipping the bits gives 1111 1010, which is -6 in signed 32-bit integer.

Key concepts

bit_manipulationflipping

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
Part of InterviewLab's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.