Capacity To Ship Packages Within D Days
Medium
Topics
Package weights nums must be shipped in order within target days. Each day loads a contiguous prefix whose total weight is at most the ship capacity. Return the minimum capacity that ships everything within target days.
Example 1
Input: weights = [1,2,3,4,5,6,7,8,9,10], days = 5 Output: 15
Example 2
Input: weights = [3,2,2,4,1,4], days = 3 Output: 6
Constraints
- 1 <= nums.length <= 5*10^4
- 1 <= target <= nums.length
- 1 <= nums[i] <= 500
Run ⌘' · Submit ⌘⏎