题目
https://leetcode.com/problems/palindrome-number/
Determine whether an integer is a palindrome. Do this without extra space.
代码
11507 / 11507 test cases passed.
Runtime: 132 ms
#define rint register int
bool isPalindrome(int x) {
if (x < 0) return false;
rint n = 0;
rint m = x;
while (m > 0) {
n = n*10 + (m % 10);
m /= 10;
}
//printf("%d\n", n);
return (x == n);
}