使用golang语言编写答案 思路:深度优先搜索,和题目LC37类似,但是不需要使用二维数组保存路径 package main import "fmt" /** * Created by Chris on 2021/8/4. */ type TreeNode struct{ Val int Left *TreeNode Right *TreeNode } func hasPathSum( root *TreeNode , sum int ) bool { return dfs(sum, root) } func dfs(sum int, node *TreeNode) bo...