Course Completion Time I
There are numCourses courses, prerequisite pairs [a, b] meaning b must be finished before a, and time[c], how long course c takes. Courses run in batches: the first batch is every course with no prerequisite; the next batch starts only when the whole current batch has finished, and holds every course whose prerequisites are now all done.
Return the total time until the last batch finishes. The prerequisites contain no cycle.
batchesTime(4, [[1, 0], [3, 2]], [1, 10, 10, 1]) -> 20
Batch one is courses 0 and 2 and takes 10; batch two is courses 1 and 3 and takes 10.
Hints
Hint 1
Run Kahn's algorithm level by level instead of with one queue: the current level is the batch, and the next level is everything whose in-degree hits zero while processing it.
Hint 2
Add the maximum duration of each level to the total.