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

Reverse Bits

Reverse the bits of an 32 bit unsigned integer A.

Input Format:

    First and only argument of input contains an integer A

Output Format:

    return a single unsigned integer denoting minimum xor value


0 <= A < 2^32

For Examples :

Example Input 1:
    A = 0
Example Output 1:
Explanation 1:
=>      00000000000000000000000000000000
Example Input 2:
    A = 3
Example Output 2:
Explanation 2:
=>        11000000000000000000000000000000

Since java does not have unsigned int, use long

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:


Click here to start solving coding interview questions