Treat n as a 32-bit number and swap every pair of neighbouring bits: bit 0 with bit 1, bit 2 with bit 3, and so on. For n = 10 (1010) the answer is 5 (0101).
Example 1
Input:
swap_odd_even_bits(10)
Output:
5
Example 2
Input:
swap_odd_even_bits(23)
Output:
43
0 <= n < 2**32No results yet
Run your code to check it against the examples, or submit to run every test.