1136. Parallel Courses
Graph TheoryTopological SortDirected Acyclic Graph
Hints
Hint 1
Try to think of it as a graph problem. It will be impossible to study all the courses if the graph had a cycle.
Hint 2
The graph is a directed acyclic graph (DAG). The answer is the longes path in this DAG.
Hint 3
You can use DP to find the longest path in the DAG.
Preparing judge…