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.
Examples
Create a free account to view this lesson.
Continue your learning journey with a 14-day free trial.
By signing up, you agree to Educative's Terms of Service and Privacy Policy