Reverse Bits

Reverse bits of an 32 bit unsigned integer

Example 1:

x = 0,

=>        00000000000000000000000000000000

return 0

Example 2:

x = 3,

=>        11000000000000000000000000000000

return 3221225472

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