Problem 1462 · Medium

Course Schedule IV

Transitive closure with Floyd-Warshall: a course reaches another through any chain of prerequisites, so each intermediate course can join two reachable pairs.

Open the interactive visualisation