题目:https://leetcode.com/problems/binary-tree-maximum-path-sum/
代码(github):https://github.com/illuz/leetcode
求一棵二叉树上的最大路径。
直接 DFS 就可以了,返回以这一棵子树且一端在上的最大路径,然后维护一个最大路径就行了。
Name | Name | Last commit date | ||
---|---|---|---|---|
parent directory.. | ||||
题目:https://leetcode.com/problems/binary-tree-maximum-path-sum/
代码(github):https://github.com/illuz/leetcode
求一棵二叉树上的最大路径。
直接 DFS 就可以了,返回以这一棵子树且一端在上的最大路径,然后维护一个最大路径就行了。