← All questions
MediumCoding

Course Schedule IV

Asked atGroww
1Give yourself 5 minutes
2Answer out loud, not in your head
3Then compare with the answer below
0
Stuck? Show a way to structure it+
  1. 01Build directed prerequisite edges.
  2. 02Choose closure strategy from n and query count.
  3. 03Propagate prerequisite sets in topological order.
  4. 04Answer each query from the closure.
  5. 05Discuss cycles according to the contract.

Reference answer

Then expect these follow-ups

  • When would Floyd-Warshall be preferable?

    Tests: follow-up reasoning

  • How would you handle a new prerequisite edge online?

    Tests: follow-up reasoning

Free to read · better with Enzo

Practice this out loud with Enzo

Enzo runs it as a mock interview, pushes back with follow-ups, and grades you on the rubric.

Next question