class Solution { public boolean isPalindrome(int x) { if(x < 0){ return false; } int tmp = x, sum = 0; boolean flag = false; while(x != 0){ sum = sum * 10 + x % 10; x /= 10; } if(sum == tmp){ flag = true; } return flag; } }
京公网安备 11010502049817号