Given a binary tree, find the subtree with maximum sum. Return the root of the subtree.
Note
It’s guaranteed that there is only one subtree with maximum sum and the given binary tree is not an empty tree.
Example
Input :
1 | 1 |
Output : 3
Code
1 | public class TreeNode { |
1 | private TreeNode maxTree; |