We use analytics and advertising cookies to understand how the site is used and whether our ads on Facebook and Instagram work. They are set only if you accept. See our Privacy Policy for details.
Topological sort produces an ordering where every edge points forward, which is exactly the answer to course-schedule and build-order questions. Kahn's algorithm - repeatedly take a node with in-degree zero - also detects cycles for free, since a cycle leaves nodes that never reach in-degree zero. The word prerequisite in a problem statement is as clear a signal as interviews give you.
Prerequisites, build order, task scheduling, or "can this be completed?"
7 problems. Each one runs in an in-browser editor against real test cases, with hints and a worked solution.
The patterns cheat sheet covers all of these in one page - what each one looks like in a problem statement, and the template that follows.