Reverse Bits

BIT MANIPULATION

Problem

Given a 32-bit unsigned integer n, reverse its bits.

Note: The function should consider all 32 bits of the input number and reverse them. The result should be returned as an unsigned integer.

Examples

reverseBits(7) // returns 3758096384 /* The binary representation of 7 is 00000000000000000000000000000111. After reversing, we get 11100000000000000000000000000000, which is 3758096384 in decimal. */
Loading...