Algorithm · Meta · Hard
You are given n courses labeled from 0 to n - 1. The duration of course i is stored in time[i]. The directed prerequisite edge [a, b] means course a must be completed before course b can start. You are also given a list of courses targets that must be completed. A course is required if it is one of the target courses, or if it is a transitive prerequisite of at least one target course. Start from each target and move backward along prerequisite edges to discover all required…
Checking your access…