Given a binary tree, find the subtree with maximum average. Return the root of the subtree.
Note
It’s guaranteed that there is only one subtree with maximum average.
Example
No.1
Input:
1 | 1 |
Output:11(it’s a TreeNode)
No.2
Input:
1 | 1 |
Output:11(it’s a TreeNode)
Code
1 | public class TreeNode { |
1 | private TreeNode maxTree; |