Minimum Node Deletions to Limit N-ary Tree Height

Given a rooted N-ary tree and a maximum permitted height N, return a deletion set with the minimum number of nodes such that the resulting tree height is at most N.

When a node u is deleted...

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: