Given a binary tree, write a program to return the average value of the nodes on each level in the form of an array.
Problem Note
- The range of node's value is in the range of 32-bit signed integer.
Example
Input:
4
/ \
8 11
/ \
13 7
Output: [4, 9.5, 10]
Explanation: The average value of nodes on level 0 is 4, on level 1 is 9.5, and on level 2 is 10. Hence return [4, 9.5, 10].