diff --git a/problems/0131.分割回文串.md b/problems/0131.分割回文串.md index 53f43eea..a797a0b5 100644 --- a/problems/0131.分割回文串.md +++ b/problems/0131.分割回文串.md @@ -378,8 +378,7 @@ class Solution: path.append(s[start_index:i+1]) self.backtracking(s, i+1, path, result) # 递归纵向遍历:从下一处进行切割,判断其余是否仍为回文串 path.pop() # 回溯 - else: - continue + def is_palindrome(self, s: str, start: int, end: int) -> bool: i: int = start @@ -413,8 +412,7 @@ class Solution: path.append(s[start_index:i+1]) self.backtracking(s, i+1, path, result) # 递归纵向遍历:从下一处进行切割,判断其余是否仍为回文串 path.pop() # 回溯 - else: - continue + ``` 回溯+高效判断回文子串 ```python