Compute the total time for workers to finish all tasks, or -1 if impossible.
Unlock detailed company stats for this questionUpgrade
N tasks, cap[i] is the capacity needed for the i-th task. M workers, throughput[j] is the maximum capacity of the j-th worker, who can take task i if cap[i] <= throughput[j]. One worker takes one task at a time, each task takes 1 second, and after finishing a task a worker needs a 1 second buffer before picking another. Return the total time needed to complete all tasks, or -1 if it is not possible.
Community answers
No answers contributed by the community yet.
Related courses

Course

Course
Course
