We’re preparing your current view and syncing the latest data.
Given a 32-bit unsigned integer, reverse its bits and return the resulting integer. The input will be provided as an integer, but you should treat it as a sequence of 32 bits. You need to reverse the order of these bits and return the new integer that corresponds to the reversed bits.
A single 32-bit unsigned integer n.
Return the 32-bit unsigned integer that results from reversing the bits of n.
The input is guaranteed to be a 32-bit unsigned integer (0 <= n < 2^32).
Example 1
Input
00000010100101000001111010011100 (binary of 43261596)
Output
00111001011110000010100101000000 (binary of 964176192)
Explanation
The binary representation of input is reversed bit by bit resulting in output.