My simple Accepted Solution in python


  • 0
    T
    class Solution(object):
        def isPalindrome(self, s):
            """
            :type s: str
            :rtype: bool
            """
            l=[]
            for i in s:
                if('0'<=i<='9' or 'a'<=i<='z' or 'A'<=i<='Z'):
                    l.append(i.lower())
            i = 0
            j = len(l)-1
            while(i<j):
                if(l[i] != l[j]):
                    return False
                else:
                    i+=1
                    j-=1
    
    
        return True

Log in to reply
 

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