Reverse the bits of a given 32-bit unsigned integer and return the resulting value. The input is provided as its decimal value; treat it as a 32-bit binary number and reverse the order of all 32 bits.
Example 1
Input: n = 43261596
Output: 964176192
Explanation: 43261596 is 00000010100101000001111010011100; reversed it is 00111001011110000010100101000000 = 964176192.
Example 2
Input: n = 1
Output: 2147483648
Explanation: 1 has only its lowest bit set. Reversing the 32 bits moves that bit to position 31, which is 2^31 = 2147483648.
Example 3
Input: n = 2
Output: 1073741824
Explanation: 2 has only bit 1 set. Reversed, it moves to bit 30, which is 2^30 = 1073741824.
Pull the bits out of the input one at a time from the least-significant end, and push each one onto the low end of a growing result. Because the result is shifted left on every step, the first bit you extract ends up in the highest position — which is exactly what reversing means.
Run checks all cases above. Submit evaluates all test cases.