sam
sam

Reputation: 21

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?

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?

Upvotes: 0

Views: 91

Answers (1)

sam
sam

Reputation: 21

Solved this using PriorityQueue in place of Queue.

Upvotes: 0

Related Questions