class Solution {
public:
bool isPalindrome(int x) {
if( x<0 )
return false;
int div=1;
int low= 0, high = 0;
int y=x;
while( x/div >= 10 )
div *= 10;
while( x ){
low = x % 10;
high = x / div;
if( low != high )
return false;
x = ( x % div ) / 10;
div = div / 100;
}
return true;
}
};
leetcode009
最新推荐文章于 2019-01-12 21:20:06 发布