Reverse the bits of a given 32-bit unsigned integer. Pattern focus: Set/Clear kth Bit. Read bits one by one and set them in the reversed position of the answer.
n = 32-bit unsigned integer represented as an int
the integer obtained by reversing all 32 bits
Example 1:
Input:
n = 43261596
Output:
964176192
Explanation:
This is the classic 00000010100101000001111010011100 example.
Example 2:
Input:
n = 0
Output:
0
Explanation:
All bits are zero, so the reverse is also zero.