mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-10 20:40:39 +08:00
Update 0131.分割回文串.md
This commit is contained in:
@ -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
|
||||||
|
Reference in New Issue
Block a user