In course schedule II : Leetcode, how can we ensure when there are multiple answers the solution is the one with increasing order of course number?

77 views Asked by At

When there are multiple solutions, I want to return the solution where courses are in ascending order. How can I do that by the topological sort algorithm?

1

There are 1 answers

0
sam On

Solved this using PriorityQueue in place of Queue.