1120. Maximum Average Subtree

Given the root of a binary tree, find the subtree with the maximum average value. Return this maximum average value.

The average of a subtree is defined as (sum of all node values in the subtree) / (number of nodes in the subtree).

A subtree is a node plus every descendant of that node. Node values may be negative, so the answer can be negative and is compared as a real number, not rounded or truncated.

Examples
Input: [5,4,8]
Output: 8
Hints
Related Problems

1120. Maximum Average Subtree

Given the root of a binary tree, find the subtree with the maximum average value. Return this maximum average value.