PIXELBANKv8.2.1
Menu

Reverse Bits

Given a 32-bit unsigned integer, reverse its bits and return the resulting integer.

Example:

Input:
43261596
Output:
964176192
Reasoning:
  • The input integer 4326159643261596 is first converted to its binary representation: 10101000001010000000010110010001010100000101000000001011001000
  • The bits are then reversed, resulting in the binary number: 0010010110000000101000000101010100100101100000001010000001010101
  • This reversed binary number is then converted back to an integer, which can be calculated as: 231+226+219+216+214+212+28+25+22=9641761922^{31} + 2^{26} + 2^{19} + 2^{16} + 2^{14} + 2^{12} + 2^{8} + 2^{5} + 2^{2} = 964176192
  • The final output is 964176192964176192

Constraints:

  • Input is a 32-bit unsigned integer
Editor

Test Results

0/0
Run code to see test results.