C++ super clean solution


#1

unsigned int Solution::reverse(unsigned int A) {
int ans = 0;
int b = 31;
while(A)
{
ans += (A & 1) << b;
A = A >> 1;
b–;
}
return ans;
}