Course Schedule II
There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai. Return the ordering of courses you should take to finish all courses. If there are many valid answers, return any of them. If it is impossible to finish all courses, return an empty array.
Course Schedule II

There are a total of numCourses courses you have to take, labeled from 0 to numCourses - 1. You are given an array prerequisites where prerequisites[i] = [ai, bi] indicates that you must take course bi first if you want to take course ai. Return the ordering of courses you should take to finish all courses. If there are many valid answers, return any of them. If it is impossible to finish all courses, return an empty array.

Example 1:
Input: {"numCourses":4,"prerequisites":[[1,0],[2,0],[3,1],[3,2]]}
Output: [0,1,2,3]
Input
arr ={"numCourses":4,"prerequisites":[[1,0],[2,0],[3,1],[3,2]]}
Courses (showing remaining prerequisites)

0

in:0

1

in:1

2

in:1

3

in:2
Queue (Ready to Take)

Empty

Course Order

[ ]

Build adjacency list and compute indegrees

Variables
VariableValue
numCourses4
DepthFunction Call
Stack empty
0/9