Question
A packing station fills shipping boxes from a line of items that must stay in order. Each box holds at most `capacity` weight units. Work through the item weights left to right, adding each item to the current box; when an item would push the box over capacity, seal the box and start a new one with that item. No single item exceeds the capacity. Return how many boxes get used (0 for no items). Example: weights [3, 4, 5, 2] with capacity 7 use 2 boxes.
boxes_needed(weights: list[int], capacity: int) → int[[3,4,5,2],7]out2State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
Vibe coding: describe the solution in plain language (or narrate it) and the coach grades your approach. Generating runnable code from your description is coming next.