Reverse Bits
Reverse the order of all 32 bits of unsigned integer n and return the result as an unsigned integer.
Example 1
n = 12147483648Explanation
The lowest bit becomes the highest bit, yielding 2^31.
Example 2
n = 42949672954294967295Explanation
All 32 one bits remain set when reversed.
Example 3
n = 00Explanation
All 32 zero bits remain zero.
Example 4
n = 21474836481Explanation
The highest bit becomes the lowest bit, yielding one.
Constraints
- 0 <= n <= 4294967295
Function contract
reverseBitsArguments: jsonSolutionRuns on your device
Loading draft…
Run: 3 examples; Submit: 32 cases, on your device.
1