Deep Dive

Topological Sort

210. Course Schedule II · Ordering · 72 of 78

1/16

Courses with arrows

A0D1C2B0F3E1
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.