Description
Given a binary tree, collect a tree’s nodes as if you were doing this: Collect and remove all leaves, repeat until the tree is empty.
Example
1 | Input: [1,2,3,4,5] |
Solution
1 | /** |
Given a binary tree, collect a tree’s nodes as if you were doing this: Collect and remove all leaves, repeat until the tree is empty.
1 | Input: [1,2,3,4,5] |
1 | /** |