题目:
题解:
class Solution:def isPalindrome(self, s: str) -> bool:n = len(s)left, right = 0, n - 1while left < right:while left < right and not s[left].isalnum():left += 1while left < right and not s[right].isalnum():right -= 1if left < right:if s[left].lower() != s[right].lower():return Falseleft, right = left + 1, right - 1return True