Tree Rows by Depth
Medium · Tree Rows by Depth
You are given the `root` of a binary tree. Group the node values by level: the first list holds the root's value, the second holds its children, the third its grandchildren, and so on. Within a level, values go from left to right, the way the nodes appear when the tree is drawn. Return the levels from top to bottom. If the tree is empty, return an empty list.…
Solve the problem →