Newbie's python code here.Runtime:268ms


  • 0
    S
        class Solution(object):
            def isPalindrome(self, x):
            """
            :type x: int
            :rtype: bool
            """
            if x or abs(x) <= (2*31 -1):
                if '-' in str(x):
                    return False
                if str(x) == str(x)[::-1]:
                    return True
                else:
                    return False
            else:
                return True

Log in to reply
 

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