Fix the codes of backtracking.

This commit is contained in:
krahets
2023-04-16 05:14:15 +08:00
parent 3d4fb3dbd7
commit 1600ed6dee
3 changed files with 0 additions and 5 deletions

View File

@ -15,15 +15,12 @@ public class preorder_find_nodes {
if (root == null) {
return;
}
// 尝试
if (root.val == 7) {
// 记录解
res.add(root);
}
preOrder(root.left);
preOrder(root.right);
// 回退
return;
}
public static void main(String[] args) {