fix(go): fix go code , refer to @joengtou @wcig @shenjq (#992)

This commit is contained in:
Reanon
2023-12-16 18:52:28 +08:00
committed by GitHub
parent 406eed82a3
commit d0f4fa69a6
3 changed files with 6 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ func preOrderII(root *TreeNode, res *[][]*TreeNode, path *[]*TreeNode) {
*path = append(*path, root)
if root.Val.(int) == 7 {
// 记录解
*res = append(*res, *path)
*res = append(*res, append([]*TreeNode{}, *path...))
}
preOrderII(root.Left, res, path)
preOrderII(root.Right, res, path)