package main func isPalindrome(x int) bool { // -1 --> -1-, impossible if x < 0 { return false } // judge if reverse(x) == x res, y := 0, x for ; x != 0; x /= 10 { res = res*10 + x%10 } return res == y }