Critical Path for a Simulation Build and Run Pipeline
Last updated: November 29, 2026
Quick Overview
Given CI pipeline steps with durations and dependency pairs, and unlimited parallel workers, return the minimum total time, each step's earliest start, and one critical path; report a cycle if one exists.
Applied Intuition
November 29, 20260
0
0 solved
Given CI pipeline steps with durations and dependency pairs, and unlimited parallel workers, return the minimum total time, each step's earliest start, and one critical path; report a cycle if one exists.
Applied Intuition's customers run simulation in CI, where building the autonomy stack, generating scenarios and running them form a dependency graph. The interviewer checks Kahn's algorithm, longest path on a DAG, and whether cycle errors are actionable.
What the Interviewer Expects
- Build the graph and in-degrees from dependency pairs
- Use Kahn's algorithm to process steps in a valid order
- Compute earliest start as the max finish time of all parents
- Reconstruct a critical path via parent pointers
- Detect cycles and name the steps involved
Key Topics to Cover
How to Approach This
- Clarify input constraints and edge cases before writing code.
- Walk through your approach verbally and confirm with the interviewer before coding.
- Start with a brute force solution, then optimize. Mention time and space complexity.
- Test your solution with examples, including edge cases like empty input or duplicates.
- Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
- How do you compute slack for each non-critical step?
- What if only W workers are available?
- How would you rerun only steps affected by a changed input?
- How would you detect the exact cycle rather than the stuck set?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice DSA ProblemsSample Answer
Requirements
durations maps step to minutes; deps lists (before, after). Workers are unlimited, so a step starts as soon as all prerequisites finish. Return total time, the start time map and a critical path...
High-Level Design
Kahn's algorithm gives a topological order. When a step finishes, push its finish time to each child: the child's start is the maximum of those, and I remember which parent produced it. The step with ...
Submit Your Answer
Applied Intuition Software Engineer Interview Guide
Interview process, tips, and preparation timeline