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

@ -19,8 +19,6 @@ func preOrderIII(root *TreeNode, res *[][]*TreeNode, path *[]*TreeNode) {
if root.Val.(int) == 7 {
// 记录解
*res = append(*res, *path)
*path = (*path)[:len(*path)-1]
return
}
preOrderIII(root.Left, res, path)
preOrderIII(root.Right, res, path)