2-line Python Solution - 72ms - Beats 91%


  • 0
    _
    class Solution(object):
        def isPalindrome(self, s):
            """
            :type s: str
            :rtype: bool
            """
            pal = [ch.lower() for ch in s if ch.isalnum()]
            return pal == pal[::-1]
    

Log in to reply
 

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