using System; using System.Collections.Generic; class Solution { /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * * @param x int整型 * @return bool布尔型 */ public bool isPalindrome (int x) { // write code here if(x<0) return false; int k=1; while(x/k>9) k*=10; while(x>=10) { var left=x%10; var right=x/k; if(left!=right) return false; x=(x-right*k-left)/10; k/=100; } return true; } }