#137Medium#22 in Uber's list· asked at 10 companies
Capacity To Ship Packages Within D Days
Hosted on LeetCode
Solve it on LeetCode, track it here.
This problem's full statement lives on LeetCode. Open it in a new tab, then come back to mark it solved, add notes and keep your streak.
LeetCode Premium locked?
Most company-tagged LeetCode problems are behind Premium. If you have ChatGPT Plus or Claude Pro, ask it for the full statement, examples and constraints. The buttons below open a chat with the prompt already filled in.
What we know
Example 1
Input: weights = [1,2,3,4,5,6,7,8,9,10], days = 5 Output: 15
Ship [1..5], [6,7], [8], [9], [10].
Example 2
Input: weights = [3,2,2,4,1,4], days = 3 Output: 6
Example 3
Input: weights = [1,2,3,1,1], days = 4 Output: 3
Constraints
- •
1 <= days <= weights.length <= 5 * 10^4 - •
1 <= weights[i] <= 500