Given a number, such as 2, how would I reverse the bits assuming it is represented in 32-bits?
Take 1 for example, as unsigned 32-bits is 00000000000000000000000000000001 and doing the flipping we get 11111111111111111111111111111110 which in turn is 4294967294
I've tried the following but it is not working.
numElements = int(raw_input())
for i in range(0,numElements):
x = int(raw_input())
print int(bin(x)[:1:-1], 2)