Loading...
Loading...
Loading...
Packages must be shipped in the given order, and each day the truck carries a load not above its capacity. Find the smallest capacity that ships everything within D days.
Example 1
Input
10 5 1 2 3 4 5 6 7 8 9 10
Output
15
Capacity 15 fits in 5 days.
Example 2
Input
3 3 1 2 3
Output
3
Try the problem first. Open one hint at a time.
The answer lies between the heaviest package and the total weight.
For a guess, count the days needed; if it fits in D days, try smaller, otherwise larger.
Write your Python code, run it on the examples and submit it to hidden tests.
Solve in the editor