Fundamentals/Topological Sort | Topological Order
← PrevNext →
Given n nodes labeled 0..n-1 and a list of directed edges [from, to], return any valid topological ordering. Return an empty array if a cycle exists.