Skip to content

Commit

Permalink
fix(go): record slice array result, fixed #1075 (#1087)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reanon authored Feb 18, 2024
1 parent e813b5a commit e9341c5
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func preOrderIII(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...))
}
preOrderIII(root.Left, res, path)
preOrderIII(root.Right, res, path)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ func isSolution(state *[]*TreeNode) bool {

/* 记录解 */
func recordSolution(state *[]*TreeNode, res *[][]*TreeNode) {
*res = append(*res, *state)
*res = append(*res, append([]*TreeNode{}, *state...))
}

/* 判断在当前状态下,该选择是否合法 */
Expand Down

0 comments on commit e9341c5

Please sign in to comment.