- See Code
O(n)
class Solution:
def validPalindrome(self, s: str) -> bool:
l, r = 0, len(s) - 1
while l < r:
if s[l] != s[r]:
pre, las = s[l:r], s[l + 1:r + 1]
return pre[::-1] == pre or las[::-1] == las
else:
l += 1
r -= 1
return True