Swap Neighbouring Bits
Swap every even-indexed bit of N with the odd-indexed bit just above it (bit 0 with bit 1, bit 2 with bit 3, ...). Print the result.
Input: one integer N.
Output: N with adjacent bit pairs swapped.
Constraints:
- 0 ≤ N < 262
Sample Tests
Input 1
10
Output 1
5
Input 2
23
Output 2
43
Discussion (opens after you solve — no spoilers before)
No comments yet.