Fix the code of preorder_traversal_iii_compact

This commit is contained in:
krahets
2023-07-21 22:08:26 +08:00
parent 075c3abf88
commit bba62bbe75
11 changed files with 19 additions and 10 deletions
@@ -19,6 +19,7 @@ func preOrderIII(root *TreeNode, res *[][]*TreeNode, path *[]*TreeNode) {
if int(root.Val) == 7 {
// 记录解
*res = append(*res, *path)
*path = (*path)[:len(*path)-1]
return
}
preOrderIII(root.Left, res, path)