Reverse Bits

Practice this coding question on Coding Gurukul.

Problem statement

A hardware adapter reverses the wiring order of a 32-bit register. The first bit becomes the last, the second becomes the second-last, and the transformation always includes all thirty-two positions. Your task Reverse the bits of the input unsigned 32-bit integer and print the resulting unsigned value in decimal. Important details Leading zero bits are part of the fixed-width input and become trailing zero bits after reversal. Do not reverse the decimal digits or use only the significant binary digits. The output may exceed the signed 32-bit maximum. Worked example The value 1 has only its least significant bit set. Reversal moves that bit to position 31, producing 2147483648.

Input format

One unsigned integer n in decimal.

Output format

Print the reversed unsigned value in decimal.

Constraints

0 <= n <= 4294967295.

Sample input

1

Sample output

2147483648

Sign in to run or submit a solution in C++, Java or Python.