Fastest Python solution 45 ms

  • 1
    def isPalindrome(self, s):
            #Get the alphanumeric characters only then lower case them
            s = filter(str.isalnum,str(s)).lower()
            #Reverse the list then compare the reversed and the original 
            return s == s[::-1]

Log in to reply

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