@ -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);
// 回退
public static void main(String[] args) {
@ -24,7 +24,6 @@ def pre_order(root: TreeNode) -> None:
pre_order(root.right)
# 回退
path.pop()
return
"""Driver Code"""
@ -23,7 +23,6 @@ def pre_order(root: TreeNode) -> None: