class Solution {
public:
int reverse(int x) {
long y=0;
while(x != 0){
y = y*10+x%10;
x /= 10;
}
if(y>INT_MAX||y<INT_MIN)
return 0;
return (int)y;
}
};
leetcode 7. Reverse Integer
最新推荐文章于 2022-06-06 18:52:41 发布