#1723

Find Minimum Time to Finish All Jobs

candidate master · 1550 · lc hard +32 · verified · 45.4% accepted · 1,130 likes · top 29%

Description

You are given an integer array jobs of job durations and k workers. Each job is assigned to exactly one worker. A worker's total time is the sum of their assigned job durations. Find an assignment that minimizes the maximum working time. Return that minimum value.

Example 1:

Input: jobs = [3,2,3], k = 3
Output: 3
Explanation: By assigning each person one job, the maximum time is 3.

Example 2:

Input: jobs = [1,2,4,7,8], k = 2
Output: 11
Explanation: Assign the jobs the following way:
Worker 1: 1, 2, 8 (working time = 1 + 2 + 8 = 11)
Worker 2: 4, 7 (working time = 4 + 7 = 11)
The maximum working time is 11.

Code

1
2
3