FreeCareerPath
Build the PrimitiveMedium

Course Schedule II

Write `find_order(num_courses, prerequisites)` returning any valid order in which every course can be taken, or `[]` when no order exists. Same graph as Course Schedule, but now you emit the order. With Kahn's algorithm the cycle check falls out for free: if the result is shorter than `num_courses`, something never reached in-degree zero. Any valid order is accepted, so do not assume one specific answer.

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 II" are saved to your account — logging in takes a few seconds.

Course Schedule II — FreeCareerPath