Merge pull request #2136 from enjoy-binbin/fix_typo_tianjia

错别字修复:已经填在的子串 -> 已经添加的子串
This commit is contained in:
程序员Carl
2023-07-02 12:34:42 +08:00
committed by GitHub

View File

@ -118,7 +118,7 @@ for (int i = startIndex; i < s.size(); i++) {
continue;
}
backtracking(s, i + 1); // 寻找i+1为起始位置的子串
path.pop_back(); // 回溯过程,弹出本次已经填在的子串
path.pop_back(); // 回溯过程,弹出本次已经添加的子串
}
```
@ -189,7 +189,7 @@ private:
continue;
}
backtracking(s, i + 1); // 寻找i+1为起始位置的子串
path.pop_back(); // 回溯过程,弹出本次已经填在的子串
path.pop_back(); // 回溯过程,弹出本次已经添加的子串
}
}
bool isPalindrome(const string& s, int start, int end) {
@ -245,7 +245,7 @@ private:
continue;
}
backtracking(s, i + 1); // 寻找i+1为起始位置的子串
path.pop_back(); // 回溯过程,弹出本次已经填在的子串
path.pop_back(); // 回溯过程,弹出本次已经添加的子串
}
}
void computePalindrome(const string& s) {
@ -437,7 +437,7 @@ class Solution:
substring = s[startIndex:i + 1]
path.append(substring)
self.backtracking(s, i + 1, path, result, isPalindrome) # 寻找i+1为起始位置的子串
path.pop() # 回溯过程,弹出本次已经填在的子串
path.pop() # 回溯过程,弹出本次已经添加的子串
def computePalindrome(self, s, isPalindrome):
for i in range(len(s) - 1, -1, -1): # 需要倒序计算保证在i行时i+1行已经计算好了
@ -497,7 +497,7 @@ func dfs(s string, start int) {
if isPalindrome(str) { // 是回文子串
path = append(path, str)
dfs(s, i+1) // 寻找i+1为起始位置的子串
path = path[:len(path)-1] // 回溯过程,弹出本次已经填在的子串
path = path[:len(path)-1] // 回溯过程,弹出本次已经添加的子串
}
}
}