Root of the Largest Tree in a Parent-Child Forest

Given parent -> child relationships that form a forest (acyclic, and every node has at most one parent), return the root of the tree with the largest number of nodes.

  • The size of a tree is the nu...

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: