LeetCode:Palindrome Number

题目描写叙述:

Determine whether an integer is a palindrome. Do this without extra space.


代码:

bool Solution::isPalindrome(int x)
{
    int a = x;
    int b = 0;
    while(a > 0)
    {
        b = b * 10 + a % 10;
        a = a % 10;
    }
    return b == x;
}



posted @ 2016-03-01 08:45  lcchuguo  阅读(109)  评论(0编辑  收藏  举报