mirror of
https://github.com/krahets/hello-algo.git
synced 2026-05-16 14:14:03 +08:00
Update preorder_traversal_iii.
This commit is contained in:
@@ -42,7 +42,7 @@ pub fn main() {
|
||||
let mut res = Vec::new();
|
||||
pre_order(&mut res, &mut path, root);
|
||||
|
||||
println!("\n输出所有根节点到节点 7 的路径,路径中不包含值为 3 的节点,仅包含一个值为 7 的节点");
|
||||
println!("\n输出所有根节点到节点 7 的路径,路径中不包含值为 3 的节点");
|
||||
for path in res {
|
||||
let mut vals = Vec::new();
|
||||
for node in path {
|
||||
|
||||
@@ -40,7 +40,6 @@ fn backtrack(state: &mut Vec<Rc<RefCell<TreeNode>>>, choices: &mut Vec<Rc<RefCel
|
||||
if is_solution(state) {
|
||||
// 记录解
|
||||
record_solution(state, res);
|
||||
return;
|
||||
}
|
||||
// 遍历所有选择
|
||||
for choice in choices {
|
||||
|
||||
Reference in New Issue
Block a user