fork download
  1. class Solution:
  2. def validPalindrome(self, s: str) -> bool:
  3. i = 0
  4. j = len(s) - 1
  5. while i <= j:
  6. if s[i].lower() != s[j].lower():
  7. skipL,skipR = s[i+1:j+1] , s[i:j]
  8. return (skipL == skipL[::-1]) or (skipR == skipR[::-1])
  9. i+=1
  10. j-=1
  11.  
  12. return True
  13.  
Success #stdin #stdout 0.11s 14180KB
stdin
Standard input is empty
stdout
Standard output is empty