public TreeNode SubtreeWithMaximumAvg(TreeNode root)
        {
            var res = new TreeNodeWrapper1();

            helper(root);

            return(res.Root);
        }
        public int helper(TreeNode root, TreeNodeWrapper1 result)
        {
            if (root == null)
            {
                return(0);
            }

            var leftTotal  = helper(root.left, result);
            var rightTotal = helper(root.right, result);

            var totalAtThisLevel = leftTotal + rightTotal + root.data;

            if (totalAtThisLevel > result.Sum)
            {
                result.Sum  = totalAtThisLevel;
                result.Root = root;
            }
            return(totalAtThisLevel);
        }