LeetCode 1136 Parallel Courses - Why Naive Fails

The trap

Try all possible semester assignments and find the minimum.

With nn courses, this explores exponentially many assignments.

Can you determine the minimum semesters using the graph structure?