Quant Memo
Coding/●●●●●

Smallest truck that delivers on schedule

Packages must ship in the given order (you cannot reorder them). Each day you load consecutive packages onto one truck until the next would exceed the truck's capacity C, then that day ends. You have D days.

weights = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10], D = 5
answer: C = 15
day 1: 1,2,3,4,5 (=15) | day 2: 6,7 | day 3: 8 | day 4: 9 | day 5: 10

Find the smallest capacity C that delivers all packages within D days.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions