Earliest Completion Time for Parallel iOS Build Pipeline Steps

Last updated: November 29, 2026

Quick Overview

Each build step has a duration and a list of prerequisite steps. With unlimited parallel workers, return the minimum total time to finish all steps, which is the length of the critical path, or -1 if the dependencies contain a cycle.

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

0

0

0 solved


Each build step has a duration and a list of prerequisite steps. With unlimited parallel workers, return the minimum total time to finish all steps, which is the length of the critical path, or -1 if the dependencies contain a cycle.

Apple's CI farms build and test iOS across many machines, so critical-path questions fit naturally. The interviewer checks that you combine topological order with a longest-path DP rather than simply summing durations.

What the Interviewer Expects
  • Recognize the critical path as the longest path in a DAG
  • Compute earliest finish times in topological order
  • Detect cycles
  • Explain why unlimited workers makes the problem polynomial
  • Optionally reconstruct the critical path
Key Topics to Cover
topological sort
DAG longest path
dynamic programming
critical path
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
  • Return the steps on the critical path.
  • With only W workers the problem becomes scheduling; what heuristic would you use?
  • Which steps have slack, meaning they can be delayed without delaying the build?
  • Durations are estimates with variance; how would you report a confidence range?
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: durations list where step i takes durations[i] minutes, and prereqs list of (before, after) pairs. Output: earliest time when all steps are complete, or -1 on a cycle. No steps return...

High-Level Design

The earliest finish of a step is its duration plus the maximum earliest finish of its prerequisites. Process steps in topological order via Kahn's algorithm so that every prerequisite's finish time is...


Submit Your Answer
Markdown supported