Course Schedule II
Try to solve the Course Schedule II problem.
We'll cover the following
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 range with no prerequisites.
Constraints:
Let be the number of courses.
-
prerequisites.length
prerequisites[i].length
- All the pairs are distinct.