Reverse Bits
Easy
Topics
Reverse the bits of a given 32-bit unsigned integer. Return the resulting unsigned integer represented as a (possibly large) number.
For example, the input 43261596 in binary is 00000010100101000001111010011100. Reversing gives 00111001011110000010100101000000 which is 964176192.
Example 1
Input: n = 43261596 Output: 964176192
Example 2
Input: n = 4294967293 Output: 3221225471
Example 3
Input: n = 0 Output: 0
Constraints
- 0 <= n <= 2^32 - 1
Run ⌘' · Submit ⌘⏎