Deep Dive

Cycle in a Directed Graph

207. Course Schedule · Ordering · 74 of 78

1/7

Can you finish every course?

BCADE
In this lessonStep 1 of 7 · ← → keys
The question

Courses depend on other courses. Can you finish all of them? Only if the dependency arrows never form a loop. DFS with three states (new, on path, finished) finds a loop.