Deep Dive
Topological Sort
210. Course Schedule II · Ordering · 72 of 78
1/16
Courses with arrows
In this lessonStep 1 of 16 · ← → keys
The question
Some courses must be finished before others. Find an order that takes every course, or report that it's impossible. This is a topological sort, using Kahn's method of counting what each course is waiting on.