Course schedule: finish every course and find an order
You have n courses and a list of prerequisite pairs.
- Decide whether every course can be completed. This fails exactly when the prerequisites contain a cycle.
- Return one valid order to take all the courses, or an empty result when there is none.
It is also asked as resolving package dependencies, where a cycle must be reported.
No answer yet. Write the first one; the best answer gets endorsed.
