Automation Pipeline, Part 2: Stage Workers
Updated
Problem statement
This is part 2 of a three-part automation-pipeline sequence.
An automation pipeline contains stages that run in the given order. Each stage is represented as [number_of_jobs, job_time, workers]. A stage must finish all of its jobs before the next stage can begin.
Within one stage, its workers process jobs in parallel. Every job is indivisible, takes exactly job_time, and occupies one worker until it finishes. A free worker immediately starts another job from the same stage while jobs remain. A job counts as completed when it finishes at or before time_limit.
Implement calculate_jobs_with_workers and return the total number of jobs completed across the pipeline by the time limit.
Function
calculate_jobs_with_workers(stages: int[][], time_limit: int) → intExamples
Example 1
stages = [[4,3,2],[10,1,1]]time_limit = 14return = 12Two workers finish the first stage's 4 jobs in two rounds, using 6 time units. The second stage then completes 8 of its jobs in the remaining 8 time units, for a total of 12.
More Plaid interview questions
- Automation Pipeline, Part 3: Stage DurationPHONE SCREEN · Seen Jul 2026
- Automation Pipeline, Part 1: Single WorkerPHONE SCREEN · Seen Nov 2026
- Validate and Resolve Evaluation ChainsPHONE SCREEN · ONSITE INTERVIEW · Seen Oct 2026
- Total Pipeline Completion TimePHONE SCREEN · Seen Sep 2026
- Rule References: Validity and EligibilityPHONE SCREEN · Seen Aug 2026
- Bounded Token-Bucket Request QueueONSITE INTERVIEW · Seen Jul 2026
- Token Bucket Request DecisionsONSITE INTERVIEW · Seen Jul 2026
Similar questions at other companies
- Sliding Window Attention over a KV CacheNVIDIA · PHONE SCREENNVIDIA interview questions
- Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
- Evenly Schedule Vehicle InspectionsAmazon · PHONE SCREEN
- Implement Cross-Entropy LossOpenAI · PHONE SCREENOpenAI interview questions
- Cumulative No-Intercept Regression BetasCitadel · PHONE SCREENCitadel interview questions
- Add Signed Character ArraysByteDance · PHONE SCREENByteDance interview questions
- Reservoir Sampling with Recorded DrawsGoogle · PHONE SCREENGoogle interview questions
- K-Means Delivery ZonesDoorDash · PHONE SCREEN · ONSITE INTERVIEWDoorDash interview questions
- Token Bucket Request DecisionsDatadog · PHONE SCREENDatadog interview questions
- Gradient Descent for Linear RegressionMicrosoft · PHONE SCREENMicrosoft interview questions