Topological Sorting of a Directed Graph

Problem

Given a directed graph, return a topological ordering. Return an empty array if the graph contains a directed cycle.

The post only identifies topological sorting as the final-round topic, ...

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: