Skip to content

Instantly share code, notes, and snippets.

View Faith6544's full-sized avatar

Mawi Faith6544

View GitHub Profile
class Solution:
def validPalindrome(self, s: str) -> bool:
def is_palindrome(s, left, right):
while left < right:
if s[left] != s[right]:
return False
left += 1
right -= 1
return True
class Solution:
def isPalindrome(self, s: str) -> bool:
new_s="".join(char for char in s if char.isalnum()).lower()
left=0
right=len(new_s) -1
while left < right:
if new_s[left]!=new_s[right]:
return False
left+=1