 All Problems
Average of Levels in Binary Tree
easy
trees
bfs
amazon
facebook
google

Given the root of a binary tree, return the average value of nodes at each level as a list. Output values to 5 decimal places.

Example:

Input: 3 9 20 null null 15 7
Output:
3.00000
14.50000
11.00000

Input format: Space-separated level-order values ("null" for absent nodes).

Output format: One average per line, 5 decimal places.

Run to check your code against the sample cases, or submit to run every case