What is problem in my submission?


#1

unsigned int Solution::reverse(unsigned int A) {
int ans=0;
int i=31;
while(i>=0)
{
ans=ans+ (A%2)<<i;
A>>=1;
i–;
}
/* while(ans)
{
cout<<(ans%2);
ans>>=1;
}*/
// cout<<"\n";
return ans;
}