个人解法思路
class Solution {
public:
int reverse(int x) {
int temp=0;//需要返回的最后结果
while(x!=0)
{
if(temp>INT_MAX/10 || temp<INT_MIN/10)
return 0;
temp=temp*10+x%10; //个位变十位 同理
x=x/10; //进行降位
}
return temp;
}
};