mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-09 19:44:45 +08:00
纠正 0131 分割回文串 JavaScript 版本代码
String 实例方法 substr 已弃用,请换成 slice
This commit is contained in:
@ -442,7 +442,7 @@ var partition = function(s) {
|
|||||||
}
|
}
|
||||||
for(let j = i; j < len; j++) {
|
for(let j = i; j < len; j++) {
|
||||||
if(!isPalindrome(s, i, j)) continue;
|
if(!isPalindrome(s, i, j)) continue;
|
||||||
path.push(s.substr(i, j - i + 1));
|
path.push(s.slice(i, j + 1));
|
||||||
backtracking(j + 1);
|
backtracking(j + 1);
|
||||||
path.pop();
|
path.pop();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user