← Back to companies
[ OK ] Loaded —
[ INFO ]
$ cd
$ ls -lt
01
02
03
04
05
$ ls -lt
01
02
03
04
05
user@intervues:~/$
There are a total of numCourses courses to take, labeled from 0 to numCourses - 1. Some courses have prerequisites given as pairs [a, b], indicating course b must be taken before course a.
Determine if it's possible to finish all courses.
Key Insight: This is a cycle detection problem in a directed graph. If there's a cycle in the prerequisite graph, it's impossible to complete all courses.
Related: Course Schedule II - Return the order of courses to take