So I am solving this problem given as:
There are bags carrying weights from 1 to 3 units and I have to carry them from point A to point B. Weights are given of bags in array. All weights are less than 3 unit.
weights = [1, 1.78, 2.2, 2.73, 3]
So I have to make the trips carrying the bags should not cross the total weight greater than 3 unit. In order to that I have to make minimum number of trips.
Example: weights = [1.01, 1.99, 2.5, 1.5, 1.01]
I can carry all bags in 3 trips minimum as:
[1.01 + 1.99, 2.5, 1.5 + 1.01].
Means how to determine the minimum no. of trips to carry the weight bags from point A to point B?
What logic can be applied?