Question bank › Bit Manipulation
Dsa Bit Manipulation Medium

Swap Odd and Even Bits

Given an integer n, swap all odd bits with the adjacent even bits. The least significant bit is considered as odd. For example: Input: 23 Output: 43 Explanation: Binary of 23 is 10111. After swapping, it becomes 101011 which is 43.

Key concepts

bit manipulationbitwise operations

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.