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 = 43261596Output:
964176192Explanation:
43261596 in binary is 00000010100101000001111010011100. Reversing the 32 bits produces 00111001011110000010100101000000. The exact output is 964176192.
Input:
n = 1Output:
2147483648Explanation:
Reversing the 32 bits of 1 gives 2147483648.
Input:
n = 0Output:
0Explanation:
Reversing the 32 bits of 0 still gives 0.
Constraints
- •
Input is a 32-bit unsigned integer.