mirror of
https://github.com/krahets/hello-algo.git
synced 2026-08-25 09:37:14 +00:00
Fix the code of preorder_traversal_iii_compact
This commit is contained in:
@@ -59,7 +59,7 @@ func TestPreorderTraversalIIICompact(t *testing.T) {
|
||||
res := make([][]*TreeNode, 0)
|
||||
preOrderIII(root, &res, &path)
|
||||
|
||||
fmt.Println("\n输出所有根节点到节点 7 的路径,且路径中不包含值为 3 的节点")
|
||||
fmt.Println("\n输出所有根节点到节点 7 的路径,路径中不包含值为 3 的节点,仅包含一个值为 7 的节点")
|
||||
for _, path := range res {
|
||||
for _, node := range path {
|
||||
fmt.Printf("%v ", node.Val)
|
||||
@@ -81,7 +81,7 @@ func TestPreorderTraversalIIITemplate(t *testing.T) {
|
||||
choices = append(choices, root)
|
||||
backtrackIII(&state, &choices, &res)
|
||||
|
||||
fmt.Println("\n输出所有根节点到节点 7 的路径,且路径中不包含值为 3 的节点")
|
||||
fmt.Println("\n输出所有根节点到节点 7 的路径,路径中不包含值为 3 的节点,仅包含一个值为 7 的节点")
|
||||
for _, path := range res {
|
||||
for _, node := range path {
|
||||
fmt.Printf("%v ", node.Val)
|
||||
|
||||
Reference in New Issue
Block a user