Back to problems

Solve Dependency, Prefix, and Cache Problems

Algorithm · Ebay · Hard

Consider a collection of tasks labeled from $$0$$ to $$total - 1$$. Along with them, you are given prerequisites, a list of two-element arrays. A pair [a, b] indicates that task b must be finished before task a can begin. Return true if all tasks can be finished under these ordering rules, and false otherwise. Example 1: Explanation: The tasks can be completed in the order 0, 1, 2, 3. Example 2: Explanation: There is a cyclic dependency among all three tasks, so no valid…

Checking your access…