PracHub
QuestionsLearningGuidesInterview Prep
|Home/Coding & Algorithms/Plaid

Count Completed Jobs in a Serial Multi-Worker Pipeline

Last updated: Jul 22, 2026

Quick Overview

Count completed jobs in a serial pipeline where each stage has several parallel workers but the next stage waits for all current work. Practice reasoning about completion waves, unfinished batches at the deadline, large integer bounds, zero-job stages, and efficient processing across many stages.

  • medium
  • Plaid
  • Coding & Algorithms
  • Software Engineer

Count Completed Jobs in a Serial Multi-Worker Pipeline

Company: Plaid

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

# Count Completed Jobs in a Serial Multi-Worker Pipeline An automation pipeline contains stages that execute in order. Each stage is represented as `[number_of_jobs, job_time, number_of_workers]`. Workers within one stage process jobs in parallel, but each worker handles at most one job at a time and a job cannot be split. The next stage begins only after every job in the current stage is complete. Given a total time limit, return how many jobs finish completely. ## Function Signature ```python def calculate_jobs_with_workers(pipeline: list[list[int]], time_limit: int) -> int: ``` ## Inputs - `pipeline[i][0]` is the number of jobs in stage `i`. - `pipeline[i][1]` is the integer duration of every job in that stage. - `pipeline[i][2]` is the number of workers available only to that stage. - All workers in a stage are available when the stage starts. ## Output Return the total number of jobs completed by `time_limit`. Jobs in progress at the limit do not count. ## Constraints - `0 <= len(pipeline) <= 100_000` - Every stage has exactly three integers. - `0 <= number_of_jobs <= 10^9` - `1 <= job_time, number_of_workers <= 10^9` - `0 <= time_limit <= 9_000_000_000_000_000` - Across the complete pipeline, `sum(ceil(number_of_jobs / number_of_workers) * job_time) <= 9_000_000_000_000_000`. - These limits keep every batch count, stage duration, cumulative duration, deadline, and returned job count within the exact integer range shared by JavaScript `Number` and signed 64-bit Java/C++ integers. - The input collection must not be mutated. ## Examples ```text pipeline = [[4, 3, 2], [10, 1, 1]] time_limit = 14 output = 12 ``` Two workers finish the first four jobs in 6 time units. During the remaining 8 time units, the single worker in stage two finishes eight jobs. ```text pipeline = [[5, 4, 2], [3, 1, 3]] time_limit = 9 output = 4 ``` Four jobs finish in two complete four-unit batches. The fifth job is incomplete at the limit, so the next stage never begins.

Quick Answer: Count completed jobs in a serial pipeline where each stage has several parallel workers but the next stage waits for all current work. Practice reasoning about completion waves, unfinished batches at the deadline, large integer bounds, zero-job stages, and efficient processing across many stages.

Related Interview Questions

  • Calculate Ordered Job Makespan Across Parallel Workers - Plaid (medium)
  • Count Completed Jobs in a Serial Single-Worker Pipeline - Plaid (medium)
  • Find Banks From Identifier Mappings - Plaid (medium)
  • Resolve routing-number to bank mapping - Plaid (easy)
|Home/Coding & Algorithms/Plaid

Count Completed Jobs in a Serial Multi-Worker Pipeline

Plaid logo
Plaid
Jul 13, 2026, 12:00 AM
mediumSoftware EngineerTechnical ScreenCoding & Algorithms
2
0

Count Completed Jobs in a Serial Multi-Worker Pipeline

An automation pipeline contains stages that execute in order. Each stage is represented as [number_of_jobs, job_time, number_of_workers]. Workers within one stage process jobs in parallel, but each worker handles at most one job at a time and a job cannot be split. The next stage begins only after every job in the current stage is complete. Given a total time limit, return how many jobs finish completely.

Function Signature

def calculate_jobs_with_workers(pipeline: list[list[int]], time_limit: int) -> int:

Inputs

  • pipeline[i][0] is the number of jobs in stage i .
  • pipeline[i][1] is the integer duration of every job in that stage.
  • pipeline[i][2] is the number of workers available only to that stage.
  • All workers in a stage are available when the stage starts.

Output

Return the total number of jobs completed by time_limit. Jobs in progress at the limit do not count.

Constraints

  • 0 <= len(pipeline) <= 100_000
  • Every stage has exactly three integers.
  • 0 <= number_of_jobs <= 10^9
  • 1 <= job_time, number_of_workers <= 10^9
  • 0 <= time_limit <= 9_000_000_000_000_000
  • Across the complete pipeline, sum(ceil(number_of_jobs / number_of_workers) * job_time) <= 9_000_000_000_000_000 .
  • These limits keep every batch count, stage duration, cumulative duration, deadline, and returned job count within the exact integer range shared by JavaScript Number and signed 64-bit Java/C++ integers.
  • The input collection must not be mutated.

Examples

pipeline = [[4, 3, 2], [10, 1, 1]]
time_limit = 14
output = 12

Two workers finish the first four jobs in 6 time units. During the remaining 8 time units, the single worker in stage two finishes eight jobs.

pipeline = [[5, 4, 2], [3, 1, 3]]
time_limit = 9
output = 4

Four jobs finish in two complete four-unit batches. The fifth job is incomplete at the limit, so the next stage never begins.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Plaid•More Software Engineer•Plaid Software Engineer•Plaid Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,500+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • AI Coding Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.