CSES - Topological ordering

Consider the following directed graph:

  • The graph contains the nodes 1,2,,N1,2,\dots,N and N=1000N=1000.
  • There is an edge from the node aa to the node bb if a<ba<b.

How many different topological orderings does the graph have?

Justify your answer briefly: