Packages with weights weights[0], weights[1], ... must be shipped in this order. Each day the ship carries a run of consecutive packages whose total weight is at most its capacity. Return the smallest capacity that ships all the packages within days days.
Example 1
Input:
ship_capacity([1, 2, 3, 4, 5, 6, 7, 8, 9, 10], 5)
Output:
15
Capacity 15 ships 1..5, 6 7, 8, 9, 10 in 5 days.
Example 2
Input:
ship_capacity([3, 2, 2, 4, 1, 4], 3)
Output:
6
Capacity 6 ships 3 2, 2 4, 1 4 in 3 days.
1 <= len(weights) <= 2 * 10**41 <= days <= len(weights)1 <= weights[i] <= 10**4No results yet
Run your code to check it against the examples, or submit to run every test.