题解 | #回文数字#
回文数字
http://www.nowcoder.com/practice/35b8166c135448c5a5ba2cff8d430c32
public boolean isPalindrome (int x) { // write code here if (x < 0) return false; int count = 0, a = x; while (a != 0){ a /= 10; count++; } int l = 1, r = (int)Math.pow(10, count-1); while (l < r){ int low = x/l%10; int high = x/r%10; if (low != high) return false; l *= 10; r /= 10; } return true; }