Reverse Bits

EasyBit Manipulation

Description

Reverse bits of a given 32 bits unsigned integer. Return the integer that results from reversing the binary representation of the input. For example, reversing 00000010100101000001111010011100 gives 00111001011110000010100101000000.

Examples

Input:n = 43261596
Output:964176192
Explanation:

43261596 in binary is 00000010100101000001111010011100. Reversing the 32 bits produces 00111001011110000010100101000000. The exact output is 964176192.

Input:n = 1
Output:2147483648
Explanation:

Reversing the 32 bits of 1 gives 2147483648.

Input:n = 0
Output:0
Explanation:

Reversing the 32 bits of 0 still gives 0.

Constraints

  • Input is a 32-bit unsigned integer.

Ready to solve this problem?

Practice solo or challenge other developers in a real-time coding battle!