Graphs pattern
Course Schedule
Given a number of courses and a list of prerequisite pairs, determine whether it is possible to finish all courses (i.e. the prerequisite graph contains no cycle). Watch it run step by step, then write your own pseudocode and get it checked by AI.
- LeetCode 207
- Medium
- 1 approach
Sign in with Google or GitHub and you land straight on this page. DSA comes with the all labs plan and every ChaiCode batch.
GraphsLeetCode 207
Medium
The approach
- 01 Kahn's algorithm (topological sort by in-degree) O(V + E)O(V + E) space
What you will learn
- How to read Course Schedule and spot the graphs pattern in it
- Kahn's algorithm (topological sort by in-degree): O(V + E) time, O(V + E) space
- The pseudocode for each approach, its line lit as the animation runs
- Practice: write your own pseudocode and get it checked
More Graphs
- Course Schedule IILC 210 · Medium
- Shortest Path AlgorithmsConcept
- Network Delay TimeLC 743 · Medium
- Cheapest Flights Within K StopsLC 787 · Medium
- Path With Minimum EffortLC 1631 · Medium
- Find the City With Fewest ReachableLC 1334 · Medium
- Union-Find (DSU)Concept
- Number of Connected ComponentsLC 323 · Medium
See Course Schedule run, step by step
Sign in and this page opens on the animation, with all 9 Graphs problems beside it.
DSA comes with the all labs plan and every ChaiCode batch.