Reverse Bits
Reverse bits of a given 32 bits signed integer.
Follow up: If this function is called many times, how would you optimize it?
Example 1
Input
n = 43261596Output
964176192The 32-bit binary representation of 43261596 is reversed to produce 964176192.
Example 2
Input
n = 2147483644Output
1073741822The 32-bit binary representation of 2147483644 is reversed to produce 1073741822.
Constraints
0 <= n <= 2^31 - 2nis even.