FreeCareerPath
Build the PrimitiveMedium

Course Schedule

Write `can_finish(num_courses, prerequisites)` returning `True` when every course can be taken. Each pair `[a, b]` means b must be taken before a. This is "does this directed graph have a cycle." A single visited set is not enough — you must distinguish *currently on the stack* from *finished*, or a diamond-shaped dependency is misreported as a cycle. Three colours, or Kahn's algorithm counting how many nodes ever reach in-degree zero.

What to expect: A timer starts when you begin. Edit the starter code, run it against the test suite as many times as you like, then finish when you're done. The reference solution and interviewer follow-up questions unlock only after you finish.

Log in to start this session

Timed sessions and your results for "Course Schedule" are saved to your account — logging in takes a few seconds.

Course Schedule — FreeCareerPath