Swap Neighbouring Bits — Solution & Editorial
Mask the even bits (0x5555...) and odd bits (0xAAAA...), shift the first left and the second right, OR together.
Complexity: O(1)
Mask the even bits (0x5555...) and odd bits (0xAAAA...), shift the first left and the second right, OR together.
Complexity: O(1)