2 Line Python Solution 48 ms


  • 0
    G

    class Solution(object):
    def isPalindrome(self, s):
    """
    :type s: str
    :rtype: bool
    """
    S=re.sub(r"\W","",s).lower()
    return S==S[::-1]


Log in to reply
 

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