1. A conveyor belt has packages that must be shipped from one port to another within D days. 2. The ith package on the conveyor belt has a weight of weights[i]. Each day, we load the ship with packages on the conveyor belt (in the order given by weights). We may not load more weight than the maximum weight capacity of the ship. 3. Return the least weight capacity of the ship that will result in all the packages on the conveyor belt being shipped within D days.
Input Format
Input is managed for you
Output Format
Output is managed for you
Constraints
1 <= days <= weights.length <= 5 * 10^4 1 <= weights[i] <= 500
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
10 2 3 4 1 5 6 7 9 8 10 5
Output
15