Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Course Schedule II
Bookmark
DFS
BFS (Kahn's)
Input
Example 1
Example 2
With Cycle
Custom
numCourses
=
4
,
prerequisites
=
[[1,0],[2,0],[3,1],[3,2]]
state
U
0
U
1
U
2
U
3
C0
C0
C1
C1
C2
C2
C3
C3
call stack
order
algo
master
.
io
Step:
Initialize state array (U=unvisited, V=visiting, D=done)
0 / 24
Input
Example 1
Example 2
With Cycle
Custom
numCourses
=
4
,
prerequisites
=
[[1,0],[2,0],[3,1],[3,2]]
0 / 24
state
U
0
U
1
U
2
U
3
C0
C0
C1
C1
C2
C2
C3
C3
call stack
order
algo
master
.
io
Step:
Initialize state array (U=unvisited, V=visiting, D=done)