Skip to content
This repository was archived by the owner on Oct 16, 2021. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions Valid Palindrome.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
class Solution(object):

def isPalindrome(self, s):

"""

:type s: str

:rtype: bool

"""

l=len(s)



i=0

j=l-1



while i<=j:

ia=s[i]

ja=s[j]



if not ia.isalnum():

i+=1

continue

if not ja.isalnum():

j-=1

continue



if ia.lower()!=ja.lower():

return False



i+=1

j-=1

return True