首页 > 代码库 > LeetCode--Palindrome Number

LeetCode--Palindrome Number

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

class Solution 
{
public:
    bool isPalindrome(int x) 
    {
        if(x < 0)
            return false;
        int org = x;
        int temp=0;
        while(x>0)
        {
            temp = temp*10 + x%10;
            x = x/10;
        }
        if(temp == org)
            return true;
        return false;
    }
};


LeetCode--Palindrome Number