Update 0131.分割回文串.md

This commit is contained in:
jianghongcheng
2023-05-26 21:06:59 -05:00
committed by GitHub
parent 4586386870
commit 78445d7557

View File

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