PracHub
QuestionsLearningGuidesInterview Prep
|Home/Coding & Algorithms/Plaid

Count Completed Jobs in a Serial Single-Worker Pipeline

Last updated: Jul 22, 2026

Quick Overview

Calculate how many jobs finish before a deadline in a serial, stage-gated, single-worker pipeline. The prompt tests cumulative-time reasoning, partial-stage completion, zero-job stages, very large counts and durations, overflow safety, and linear processing without mutating input.

  • medium
  • Plaid
  • Coding & Algorithms
  • Software Engineer

Count Completed Jobs in a Serial Single-Worker Pipeline

Company: Plaid

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

# Count Completed Jobs in a Serial Single-Worker Pipeline An automation pipeline contains stages that execute in order. Each stage is represented as `[number_of_jobs, job_time]`. A stage has one worker, its jobs run one at a time, and the next stage cannot begin until every job in the current stage is complete. Given a total time limit, return how many jobs across the pipeline finish completely within that time. ## Function Signature ```python def calculate_jobs_completed(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 each job in that stage. - `time_limit` is the total time available from the start of stage 0. ## Output Return the total number of fully completed jobs. A job still running when the time limit expires does not count. ## Constraints - `0 <= len(pipeline) <= 100_000` - Every stage has exactly two integers. - `0 <= number_of_jobs <= 10^9` - `1 <= job_time <= 10^9` - `0 <= time_limit <= 9_000_000_000_000_000` - Across the complete pipeline, `sum(number_of_jobs * job_time) <= 9_000_000_000_000_000`. - These limits keep every 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], [10, 1]] time_limit = 14 output = 6 ``` The first stage completes four jobs in 12 time units. Two time units remain, so two jobs complete in the second stage. ```text pipeline = [[3, 5], [2, 1]] time_limit = 12 output = 2 ``` Only two jobs in the first stage finish; the second stage cannot start.

Quick Answer: Calculate how many jobs finish before a deadline in a serial, stage-gated, single-worker pipeline. The prompt tests cumulative-time reasoning, partial-stage completion, zero-job stages, very large counts and durations, overflow safety, and linear processing without mutating input.

Related Interview Questions

  • Count Completed Jobs in a Serial Multi-Worker Pipeline - Plaid (medium)
  • Calculate Ordered Job Makespan Across Parallel Workers - 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 Single-Worker Pipeline

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

Count Completed Jobs in a Serial Single-Worker Pipeline

An automation pipeline contains stages that execute in order. Each stage is represented as [number_of_jobs, job_time]. A stage has one worker, its jobs run one at a time, and the next stage cannot begin until every job in the current stage is complete. Given a total time limit, return how many jobs across the pipeline finish completely within that time.

Function Signature

def calculate_jobs_completed(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 each job in that stage.
  • time_limit is the total time available from the start of stage 0.

Output

Return the total number of fully completed jobs. A job still running when the time limit expires does not count.

Constraints

  • 0 <= len(pipeline) <= 100_000
  • Every stage has exactly two integers.
  • 0 <= number_of_jobs <= 10^9
  • 1 <= job_time <= 10^9
  • 0 <= time_limit <= 9_000_000_000_000_000
  • Across the complete pipeline, sum(number_of_jobs * job_time) <= 9_000_000_000_000_000 .
  • These limits keep every 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], [10, 1]]
time_limit = 14
output = 6

The first stage completes four jobs in 12 time units. Two time units remain, so two jobs complete in the second stage.

pipeline = [[3, 5], [2, 1]]
time_limit = 12
output = 2

Only two jobs in the first stage finish; the second stage cannot start.

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.