Company: NxtWave
Difficulty: medium
Box Packing Optimization Problem Description You work at a high-end electronics fulfillment center where products arrive sequentially on a conveyor belt. Each product is represented as items[i] = [length, security] , where length is the physical length and security is the security level of the i -th item. You have standard shipping boxes, each with a fixed maximum length capacity boxCapacity . Items must be packed in the given order from the conveyor belt into the shipping boxes. Shipping Cost Rule: The cost to ship a box is determined by the highest security level among the items in that box. Example: If a box contains items with security levels (2, 1, 5) , the shipping cost for that box is 5 . At each step, you can: Add the next item to the current box, as long as the total length does not exceed boxCapacity . Or, Seal and dispatch the current box and start a new box for the next item. The total shipping cost is the sum of the shipping costs of all boxes you used. Examples Example 1: