> For the complete documentation index, see [llms.txt](https://851958789.gitbook.io/notes/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://851958789.gitbook.io/notes/0124_binary_tree_maximum_path_sum/slt.md).

# 思路1 递归

* 一个节点要么往上走（父节点），要么往下走（右子节点）。每条路径有一个最高点。
* max\_down(node)递归
  1. 计算了以node为最高点的路径的sum。（用来更新res）
  2. 为node节点的父节点返回了 左或右（再加上自己）的最大值
