Python Way of doing it


#1

def reverse(self, A):

    ans = bin(A)[2:][::-1]
    
    f = "0"*32
    
    res = ans + f[len(ans):]
    
    return int(res,2)