From 78445d75573bd7d45e42a52cb1388a5f61449a73 Mon Sep 17 00:00:00 2001 From: jianghongcheng <35664721+jianghongcheng@users.noreply.github.com> Date: Fri, 26 May 2023 21:06:59 -0500 Subject: [PATCH] =?UTF-8?q?Update=200131.=E5=88=86=E5=89=B2=E5=9B=9E?= =?UTF-8?q?=E6=96=87=E4=B8=B2.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0131.分割回文串.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) 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