Divide and Conquer
Bit Manipulation
Reverse bits of a given 32 bits unsigned integer.
Given the decimal value of a 32-bit unsigned integer `n`, return *the decimal value of its bits reversed*.
Example 1
Input: n = 43261596
Output: 964176192
Explanation: 43261596 is 00000010100101000001111010011100 in binary, which reversed is 00111001011110000010100101000000 = 964176192.
Example 2
Input: n = 4294967293
Output: 3221225471
Constraints
- •
The input must be a binary string of length 32, represented here as its unsigned decimal value (0 <= n <= 2³² - 1).