the very simple python code

  • 0

    class Solution(object):
    def isPalindrome(self, x):
    :type x: int
    :rtype: bool

        if x<0:
            return False
        sx = str(x)
        _sx = '%' + sx
        for i in range(1, int(len(_sx)/2)+1):
            if _sx[i] != _sx[-i]:
                return False
        return True

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.