Earliest Go-Live Time for a New Fulfillment Center Launch Plan

Last updated: November 29, 2026

Quick Overview

Launching a fulfillment center involves n tasks, each with a duration and a set of prerequisite tasks; tasks without pending prerequisites can run in parallel. Return the earliest time all tasks finish, or -1 if the prerequisites are circular.

Amazon
Coding & Algorithms
Software Engineer
Amazon
November 29, 2026
Software Engineer
Onsite
Coding & Algorithms
Medium

0

0

0 solved


Launching a fulfillment center involves n tasks, each with a duration and a set of prerequisite tasks; tasks without pending prerequisites can run in parallel. Return the earliest time all tasks finish, or -1 if the prerequisites are circular.

Amazon opens and retools fulfillment centers constantly, and launch plans are dependency graphs with durations. The interviewer is testing critical path computation on a DAG with topological order, and whether you can explain why max, not sum, propagates along edges.

What the Interviewer Expects
  • Recognize the answer is the longest weighted path in the DAG
  • Propagate earliest start times in topological order using max
  • Detect cycles
  • O(n + m) time
  • Explain how to recover the critical path
Key Topics to Cover
critical path
topological sort
longest path in DAG
project scheduling
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • How would you list the tasks on the critical path?
  • Which tasks have slack, and how much?
  • What if only k crews are available so at most k tasks run at once?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: n, durations[i], and (u, v) pairs meaning u must finish before v starts. Unlimited parallel crews. Output: the earliest moment every task is finished, or -1 if there is a cycle....

High-Level Design

A task can start once its slowest prerequisite finishes: start[v] = max(start[u] + durations[u]) over prerequisites u. That recurrence is valid only if every u is finalized before v, which is exactl...


Submit Your Answer
Markdown supported