Example 1

Example 2

n == graph.length2 <= n <= 150 <= graph[i][j] < ngraph[i][j] != i (i.e., there will be no self-loops).All the elements of graph[i] are unique.The input graph is guaranteed to be a DAG.Example 1

Example 2

n == graph.length2 <= n <= 150 <= graph[i][j] < ngraph[i][j] != i (i.e., there will be no self-loops).All the elements of graph[i] are unique.The input graph is guaranteed to be a DAG.