最朴素的想法,直接写就好,不用什么dp之类的 class Solution: def palindrome(self , str: str) -> bool: lens=len(str) i,j=0,lens-1 while i<=j: if str[i]==str[j]: i=i+1 j=j-1 else: if str[i+1]==str[j]: ...