LeetCode #7 整数反转
2020-02-03 本文已影响0人
HU兔兔
class Solution {
public:
int reverse(int x) {
long long y=0;
int z=x>=0?1:-1;
while(x){
y=y*10+x%10;
x=x/10;
}
if(y>2147483647||y<-2147483648){
y=0;
}
return y;
}
};
![](https://img.haomeiwen.com/i8016535/f247d15c6113e765.png)