A CI system has two build machines. Each job in durations takes that many minutes, and every job must run on exactly one machine.
Write minQueueDifference(durations) that splits the jobs between the two machines so that their total minutes are as close as possible, and returns the smallest possible difference between the two totals.
Input: durations = [3,1,4,2,2] Output: 0
3 + 1 + 2 = 6 on one machine and 4 + 2 = 6 on the other.
Input: durations = [10,3] Output: 7
One job per machine is the best split: 10 - 3 = 7.
1 <= durations.length <= 161 <= durations[i] <= 1000Run 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 #295 Balance Two Deploy Queues. 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.