您的位置:首页 > 其它

【leetcode】Reverse Integer

2013-10-08 20:53 351 查看
class Solution {
public:
int reverse(int x) {
// Note: The Solution object is instantiated only once and is reused by each test case.
int newVal=0;
while(x!=0)
{
newVal=newVal*10+x%10;
x/=10;
}
return newVal;
}
};
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: