← All problemsSign in

swapping binary

Keerthi is given an unsigned integer $M$. Her task is to swap all odd bits with even bits. For example, if the given number is $23$ (00010111), it should be converted to $43$ (00101011). Here, every even position bit is swapped with an adjacent bit on the right side, and every odd position bit is swapped with an adjacent bit on the left side. So she has to solve this problem by above logic. Give t

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start