Scenario questions on Dijkstra, minimum spanning trees, KMP, Fenwick trees, and other classic algorithms. Match the constraints to the right algorithm.
Each card is a realistic scenario, so the work is matching constraints to an algorithm: negative weights, dense versus sparse graphs, offline versus online queries. Answers include the complexity and when the distractors would have been right. Cards are scheduled with spaced repetition: missed cards return sooner, and known cards space out.
You're building a ride-share ETA service. Roads have positive travel times that vary by segment, and you need the…
You're laying fiber to connect 10,000 cell towers using the minimum total cable. The candidate trench segments form a…
You're analyzing a microservice call graph to find groups of services that mutually depend on each other (so you can…
You're scanning DNA strings up to 10 million bases and need the longest palindromic substring of each. A naive O(n^2)…
You have a static org-chart tree of 200,000 employees and must answer 'who's the lowest common manager of employees u…
A multiplayer game server routes units across a 2,000 by 2,000 tile map with four-way movement. Roads cost 1 per tile…
A league splits 3,000 players into two teams, with a list of 20,000 rival pairs who must land on opposite teams. You…
A nightly job loads 50 million request latencies into an in-memory array and needs the exact p99. It computes one…
A scheduler must split an ordered queue of one million jobs with known durations into at most 24 contiguous shifts…
A shared lab room receives 20,000 booking requests for next quarter, each with a fixed start and end time. You must…
A courier leaves the depot, must visit 15 stops exactly once, and returns to the depot. A billing contract requires the…
A cache tier of 400 nodes scales up and down every hour. Clients must compute each key's owner locally with no shared…