Problem Statement
A conveyor belt has packages that must be shipped from one port to another within B days. The ith package on the conveyor belt has a weight of A[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. Return the least weight capacity of the ship that will result in all the packages on the conveyor belt being shipped within B days.
Example 1
A = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10] B = 5
Ans - 15
Explaination
we need to ship the packages within 5 days, so minimumin capacity of ship we need is 15 because we will ship in following ways:
day 1 - [1, 2, 3, 4, 5] = total weight = 15
day 2- [6, 7], total weight = 13
day 3 - [8], total weight = 8
day 4 -[9], total weight = 9
day 5 -[10], total weight = 10
Read Full Interview Experience here
https://leetcode.com/discuss/interview-experience/4681799/Expedia-or-SDE3-or-Gurgaon-or-Feb-2024-Reject