x written with exactly 32 bits (leading zeros included). Reverse the order of those 32 bits and return the resulting number as an unsigned value.x=6 → 1610612736
6 is 000…0110 in 32 bits. Reversed it becomes 0110…000, i.e. bits 30 and 29: 2³⁰ + 2²⁹ = 1610612736.
x=1 → 2147483648
The lowest bit moves to the very top: 2³¹ = 2147483648.
x=4294967295 → 4294967295
All 32 bits are ones, so reversing changes nothing.
x < 2³²x=6
1610612736
Run checks the first 3 tests in your browser. Submit checks all 9 tests on the server, hidden ones included.