Back to problems

Deploy Packages in Dependency Order

Algorithm · Oracle · Medium

Suppose a project consists of $$n$$ packages numbered from $$0$$ to $$n-1$$. You are given $$m$$ dependency rules. Each rule is written as two integers a and b, and it means that package a can be deployed only after package b. Print a valid deployment order that includes every package exactly once. Any order satisfying every rule is acceptable. If the dependency graph has a directed cycle, then no complete order exists, and you should print an empty line. Input Format The…

Checking your access…