Solution: Course Schedule

Let's solve the Course Schedule problem using the Topological Sort pattern.

Statement

There are a total of numCourses courses you have to take. The courses are labeled from 0 to numCourses - 1. You are also given a prerequisites array, where prerequisites[i] = [a[i], b[i]] indicates that you must take course b[i] first if you want to take the course a[i]. For example, the pair [1,0][1, 0] indicates that to take course 11 ...

Access this course and 1400+ top-rated courses and projects.