Automation Pipeline, Part 1: Single Worker
Updated
Problem statement
This is part 1 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]. A stage must finish all of its jobs before the next stage can begin.
The pipeline has one worker. The worker processes one job at a time, and each job in a stage takes exactly that stage's job_time. A job counts as completed when it finishes at or before time_limit.
Implement calculate_jobs_completed and return the total number of jobs completed across the pipeline by the time limit.
Function
calculate_jobs_completed(stages: int[][], time_limit: int) → intExamples
Example 1
stages = [[4,3],[10,1]]time_limit = 14return = 6The first stage completes 4 jobs in 12 time units. The remaining 2 time units complete 2 jobs from the second stage, for a total of 6.
More Plaid interview questions
- 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
- Automation Pipeline, Part 3: Stage DurationPHONE SCREEN · Seen Jul 2026
- Automation Pipeline, Part 2: Stage WorkersPHONE SCREEN · Seen Jul 2026
- Bounded Token-Bucket Request QueueONSITE INTERVIEW · Seen Jul 2026
- Token Bucket Request DecisionsONSITE INTERVIEW · Seen Jul 2026
Similar questions at other companies
- Apply Affine Array TransformationsByteDance · PHONE SCREENByteDance interview questions
- Exponential Backoff DelaysWonderful · PHONE SCREEN
- Recover Document Hierarchy from IndentationReducto · PHONE SCREEN
- Latency Bucket CounterDatadog · OA · PHONE SCREENDatadog interview questions
- Mini-Batch Data LoaderOpenAI · PHONE SCREENOpenAI interview questions
- Shuffle a Deck From Random ChoicesGoogle · PHONE SCREENGoogle interview questions
- Sliding Window Attention over a KV CacheNVIDIA · PHONE SCREENNVIDIA interview questions
- Constant-Time Weighted Pick with an Alias TableEtched · PHONE SCREEN
- Deterministic K-Means AssignmentsLyft · PHONE SCREENLyft interview questions
- Deterministic K-Means AssignmentsMeta · PHONE SCREEN · ONSITE INTERVIEWMeta interview questions