Binary Tree Maximum Path Sum II
Given a binary tree, find the maximum path sum from root.
The path may end at any node in the tree and contain at least one node in it.
Example
Given the below binary tree:
return 4. (1->3)
Solution
为什么需要与零比较,主要是如果左右子树的值是负数,那么直接舍去,不需要。
Last updated
Was this helpful?