HardPro challengePythonJavaScriptTypeScript

Worker Pool Scheduler

Node.jsSchedulingAlgorithms

Schedule N tasks (each with a duration) across W workers.
Each worker is single-threaded; pick the worker that becomes free earliest.

solve(workers, durations) returns total elapsed time (max worker time).

Sample tests

Test #14 equal tasks, 2 workers
Input: [2,[10,10,10,10]]
Output: 20
Test #2Single worker = sum
Input: [1,[5,10,15]]
Output: 30
Test #33 workers each take 1 task
Input: [3,[1,1,1]]
Output: 1
Test #4Greedy assigns 10 to worker A, 5+5+5=15 to worker B
Input: [2,[10,5,5,5]]
Output: 15
Test #5Idle workers
Input: [4,[1]]
Output: 1