You are given numCourses courses labeled 0 to numCourses - 1 and a list of prerequisite pairs. Each pair [a, b] means you must take course b before course a.
Return a valid ordering of courses you should take to finish all numCourses courses. If it is impossible to finish all courses (due to a cycle), return an empty array.
There may be multiple valid orderings; return any one of them.
Input: numCourses = 2, prerequisites = [[1, 0]] Output: [0, 1] Explanation: Take course 0 first, then course 1.
Input: numCourses = 4, prerequisites = [[1, 0], [2, 0], [3, 1], [3, 2]] Output: [0, 2, 1, 3] Explanation: One valid order is 0 -> 2 -> 1 -> 3. Also [0, 1, 2, 3] is valid.
1 <= numCourses <= 20000 <= prerequisites.length <= 5000prerequisites[i].length == 20 <= a, b < numCoursesnumCourses = 2, prerequisites = [[1, 0]]