jobs, where job i takes jobs[i] units of time. Hand the jobs out to workers workers so that each job goes to exactly one of them. A worker's load is the total time of all their jobs.
Assign the jobs so that the largest load among the workers is as small as possible, and return that load.jobs=[5, 3, 2, 4], workers=2 → 7
One worker takes 5 and 2, the other takes 3 and 4, so both are busy for 7. That is the best possible, since the total work is 14.
jobs=[9, 1, 1], workers=3 → 9
Everyone gets one job, and the longest one takes 9.
jobs=[6, 6, 6, 6], workers=3 → 12
Four jobs for three workers means someone gets two of them, which is 12.
jobs=[5, 3, 2, 4], workers=2
7
Run checks the first 3 tests in your browser. Submit checks all 113 tests on the server, hidden ones included.