Algorithm · LinkedIn · Medium
You are given the root of an N-ary tree. Your task is to simulate a process where, each day, you simultaneously delete every leaf node (a node with no children) currently in the tree. After removal, some internal nodes may become leaves because all their children were deleted; those nodes will be removed on the following day. The process repeats until the entire tree is gone, with the root being the very last node removed. Return a list days, where days[i] is a list…
Checking your access…