Python code using strings (beats 85%)


  • 0
    A
        def isPalindrome(self, x):
            """
            :type x: int
            :rtype: bool
            """
            x = str(x) #since no extra space to be used
            return x == x[::-1]

Log in to reply
 

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