Python two line 62ms


  • 0
    L

    class Solution(object):
    def isPalindrome(self, s):
    """
    :type s: str
    :rtype: bool
    """
    s = ''.join(c.lower() for c in s if c.isalnum())
    return s == s[::-1]


Log in to reply
 

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