InterviewBit Academy is now Scaler!
InterviewBit Academy is now Scaler Academy!

Reverse Bits


Problem Description

Reverse the bits of an 32 bit unsigned integer A.



Problem Constraints

0 <= A <= 232



Input Format

First and only argument of input contains an integer A.



Output Format

Return a single unsigned integer denoting the decimal value of reversed bits.



Example Input

Input 1:

 0

Input 2:

 3



Example Output

Output 1:

 0

Output 2:

 3221225472



Example Explanation

Explanation 1:

        00000000000000000000000000000000
=> 00000000000000000000000000000000

Explanation 2:

        00000000000000000000000000000011    
=>      11000000000000000000000000000000



NOTE: You only need to implement the given function. Do not read input, instead use the arguments to the function. Do not print the output, instead return values as specified. Still have a doubt? Checkout Sample Codes for more details.
Start solving Reverse Bits on Interview Code Editor
Sign Up
to access hints and editorial solutions for Reverse Bits
Asked In:

Discussion


Loading...
Click here to start solving coding interview questions