Amazon has employees working on shifts. Now, for a shift there a list of tasks that an employee needs to perform in order to be eligible to work on that shifts.
For example, a shift requires a person to do 3 tasks to be eligible for pay premium.
Now, in turn each of these tasks have prerequisites. For example, in order to complete task 1, you should have completed task A and task B.
So you are given a number of tasks required for a shifts. (N) You are also given a list of dependency, prerequisites[i] = [ai, bi].
This indicates that you must complete task bi first if you want to complete task ai.