Solution: Course Schedule II
Let's solve the Course Schedule II problem using the Topological Sort pattern.
Statement
Let’s assume that there are a total of courses labeled from to . Some courses may have prerequisites. A list of prerequisites is specified such that if , you must take course before course .
Given the total number of courses and a list of the prerequisite pairs, return the course order a student should take to finish all of the courses. If there are multiple valid orderings of courses, then the return any one of them.
Note: There can be a course in the to ...
Access this course and 1400+ top-rated courses and projects.