Topological Sort DFS

Given a directed graph with n vertices numbered 0 to n-1 and a list of edges where each edge [u, v] means u must appear before v, return any valid topological ordering of the vertices. If the graph contains a cycle, no valid ordering exists; return an empty array.

Examples
Input: [4,[[0,1],[1,2],[2,3]]]
Output: [0,1,2,3]
Hints

Topological Sort DFS

Given a directed graph with `n` vertices numbered `0` to `n-1` and a list of `edges` where each edge `[u, v]` means `u` must appear before `v`, return any valid topological ordering of the vertices. If the graph contains a cycle, no valid ordering exists; return an empty array.