Sponsored
Use these hints if you're stuck. Try solving on your own first.
Node with indegree 0 is the root
Solve with full IDE support and test cases