Prune an N-ary Tree to a Maximum Depth
Given a rooted N-ary tree and an integer k:
- Return the maximum depth of the tree.
- Delete as few nodes as possible so that the remaining tree has maximum depth at most
k.
Use the following ...
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Standard Input
Execution Result:
