mirror of
https://github.com/krahets/hello-algo.git
synced 2025-12-19 07:17:54 +08:00
fix preorder_traversal_iii_compact code
This commit is contained in:
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user