My python O(n) very easy


  • -2
    Z
    class Solution:
    # @return a boolean
    def isPalindrome(self, x):
        s = str(x)
        if s == s[::-1]:
            return True
        return False

  • 0
    K

    class Solution:
    # @return a boolean
    def isPalindrome(self, x):
    x = str(x)
    return x[::-1]==x

    just 2


  • 0
    S

    class Solution:
    # @return a boolean
    def isPalindrome(self, x):
    return str(x)[::-1]==str(x)
    just 1 LOL


Log in to reply
 

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