educative.io

Educative

Start from sink, more order are valid

I started the sorting from sink first and they are more valid order than provided on the example

like 5 3 6 2 4 0 1

is also a valid sort.

The solution says

There are other valid topological ordering of the graph too.

So it’s possible.