fix preorder_traversal_iii_compact code

This commit is contained in:
krahets
2023-09-09 00:51:00 +08:00
parent 2217ffc447
commit f71b2a40da
14 changed files with 17 additions and 37 deletions

View File

@@ -21,8 +21,6 @@ fn pre_order(res: &mut Vec<Vec<Rc<RefCell<TreeNode>>>>, path: &mut Vec<Rc<RefCel
if node.borrow().val == 7 {
// 记录解
res.push(path.clone());
path.remove(path.len() - 1);
return;
}
pre_order(res, path, node.borrow().left.clone());
pre_order(res, path, node.borrow().right.clone());