class Solution { public: /** * @param root: the root of binary tree * @return: the root of the maximum average of subtree */ TreeNode * findSubtree2(TreeNode * root) { // write your code here if (!root || (!root->left && !root->right)) return root; double maxAvg = INT_MIN; TreeNode *maxNode = NULL; int size = 0; recur(root,maxNode, size, maxAvg); return maxNode; }