My short python solutions


  • 0
    X

    def isPalindrome(self, s):

        characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'      
        s1 = reduce(lambda x , y : x + y,[ch.lower() for ch in s if ch in characters],'')
        return s1 == s1[::-1]

Log in to reply
 

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