Chain of Command
In an organizational structure represented as a tree with n members, each member is a node. The tree structure is given by an array parent[], where parent[i] = -1 means the root node, and others indic...
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:
