Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 1136. Parallel Courses
Given n courses and prerequisite pairs, determine the minimum number of semesters required to finish all courses if you can take any number of courses per semester as long as all their prerequisites are already completed; return -1 if a cycle makes completion impossible. This reduces to topological sorting / BFS layer-by-layer on the DAG to count semesters (or detecting cycles).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.