Problem
Treat n as an unsigned 32-bit integer and reverse the order of its 32 bits: bit 0 swaps with bit 31, bit 1 with bit 30, and so on. Return the result, also as an unsigned 32-bit value (between 0 and 2^32 - 1).
Example 1
- Input
- n = 43261596
- Output
- 964176192
Example 2
00000010100101000001111010011100
Example 3
→ 00111001011110000010100101000000
Example 4
- Input
- n = 1
- Output
- 2147483648
- Why
- only the top bit is set
Example 5
- Input
- n = 4294967293
- Output
- 3221225471
Constraints
0 <= n <= 2^32 - 1Always reverse all 32 bits, including leading zeros.