Question
-
Given the root node of a tree, return an array where each element is the width of the tree at each level.
-
Given:
0
/ | \
1 2 3
| |
4 5
- Answer:
[1, 3, 2]
Given the root node of a tree, return an array where each element is the width of the tree at each level.
Given:
0
/ | \
1 2 3
| |
4 5
[1, 3, 2]