C++ soln without shifting any bit


#1

Comment body goes here.`unsigned int Solution::reverse(unsigned int A) {
unsigned int ans=0;
int i =31;

while(A>0){
    int r = A%2;
    if(r!=0)
        ans +=pow(2,i);
        
        
    A /=2;
    i--;
}

return ans;

}
`