You are given the root of a binary tree. Repeatedly remove all leaf nodes (nodes with no children) from the tree, and collect the values of these nodes in a list for each round of removal. Continue this process until the tree is empty. Return a list of lists, where each inner list contains the values of the leaves removed at each round, in the order they were removed.
Constraints:
[1, 100].Return the list of lists of node values, where each inner list represents the leaves removed in each round.
Need help or want more practice?