FastPrepTotal Pipeline Completion Time

Total Pipeline Completion Time

Plaid logoPlaid● EasyFULLTIMEPHONE SCREEN
Learn

Problem statement

Each row of tasks is [taskTime, taskCount]. A single worker processes every task sequentially. Each of the taskCount tasks in that row takes exactly taskTime time units.

Return the time when all tasks from all rows have completed.

Function

totalPipelineTime(tasks: int[][]) → long

Examples

Example 1

tasks = [[3,4],[5,2]]return = 22

Four three-unit tasks and two five-unit tasks take 12 + 10 time units.

Example 2

tasks = [[7,1]]return = 7

The only task takes seven units.

Example 3

tasks = [[2,0],[4,3]]return = 12

The zero-count row contributes nothing.

Constraints

  • 1 <= tasks.length <= 10^5.
  • 0 <= taskTime, taskCount <= 10^9.
  • The answer fits a signed 64-bit integer.

More Plaid problems

See Plaid hiring insights
public long totalPipelineTime(int[][] tasks) {
    // Write your solution here.
}
tasks[[3,4],[5,2]]
expected22
Checking account…