This commit is contained in:
@@ -28,10 +28,15 @@ void backtrack(NodeState &node, vector<NodeState> &result, int para1, int para2,
|
||||
return;
|
||||
}
|
||||
|
||||
// 剪枝
|
||||
// 当现在的节点不可能出现我们想要的结果时,直接跳过。
|
||||
if (/* out of scope */) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 遍历该节点的所有子节点,即遍历下一层
|
||||
for (...) {
|
||||
// 剪枝
|
||||
// 当现在的节点不可能出现我们想要的结果时,直接跳过。
|
||||
// 剪枝也可以在 for 循环中完成
|
||||
if (/* out of scope */) {
|
||||
continue;
|
||||
}
|
||||
|
@@ -3,3 +3,5 @@
|
||||
## [131. 分割回文串](https://leetcode.cn/problems/palindrome-partitioning/)
|
||||
|
||||

|
||||
|
||||
## [93. 复原 IP 地址](https://leetcode.cn/problems/restore-ip-addresses/)
|
||||
|
Reference in New Issue
Block a user