A CI system must run a queue of build jobs in order. jobs[i] is how many minutes job i takes. Each day, the runner works through the queue from where it stopped, but it can't start a job that would push the day's total past its daily capacity in minutes. Jobs can't be split across days.
Write minCapacity(jobs, days) that returns the smallest daily capacity that finishes all jobs within days days.
Input: jobs = [3,2,2,4,1,4], days = 3 Output: 6
With capacity 6 the days are [3, 2], [2, 4], [1, 4]. Capacity 5 would need 4 days.
Input: jobs = [1,2,3,1,1], days = 4 Output: 3
Days [1, 2], [3], [1, 1] fit in capacity 3.
1 <= days <= jobs.length <= 500001 <= jobs[i] <= 500Run tries your code on the examples. Submit runs every test, including hidden edge cases, and solves the problem when they all pass.
Ctrl + Enter runs, Ctrl + Shift + Enter submits (⌘ on a Mac).
I'm here to help with #170 Build Runner Capacity. I give hints, never the solution, so you get to solve it yourself. Ask for a hint, select code to ask about it, or press Ask Tuto why on a failing test.
Your first 3 answers need no account. for free to keep asking.