You are given an array boxes, where boxes[i] = [ports_i, weights_i] denotes that the ports_i and has a weight of weights_i. You are also given integers portsCount, maxBoxes, and maxWeight.
There is a ship located at a storage facility that can deliver the boxes. The ship operates under the following conditions:
The boxes must be delivered in the exact order they are listed in boxes.
In a single journey, the ship can load at most maxBoxes boxes.
In a single journey, the total weight of the loaded boxes cannot exceed maxWeight.
The ship begins each journey at the storage facility, delivers the current batch of boxes to their respective ports in order, and then returns to the storage facility.
Traveling from the storage facility to a port, traveling from one port to another distinct port, or traveling from a port back to the storage facility each counts as
Return the minimum total number of trips required to deliver all the boxes and return the ship to the storage facility.
Constraints:
boxes.length
portsCount, maxBoxes, maxWeight
ports_i portsCount
weights_i maxWeight
You are given an array boxes, where boxes[i] = [ports_i, weights_i] denotes that the ports_i and has a weight of weights_i. You are also given integers portsCount, maxBoxes, and maxWeight.
There is a ship located at a storage facility that can deliver the boxes. The ship operates under the following conditions:
The boxes must be delivered in the exact order they are listed in boxes.
In a single journey, the ship can load at most maxBoxes boxes.
In a single journey, the total weight of the loaded boxes cannot exceed maxWeight.
The ship begins each journey at the storage facility, delivers the current batch of boxes to their respective ports in order, and then returns to the storage facility.
Traveling from the storage facility to a port, traveling from one port to another distinct port, or traveling from a port back to the storage facility each counts as
Return the minimum total number of trips required to deliver all the boxes and return the ship to the storage facility.
Constraints:
boxes.length
portsCount, maxBoxes, maxWeight
ports_i portsCount
weights_i maxWeight