Code Room
CodingMediumcod-g1494
Subject Dynamic programming 1dLevel Entry–Mid~15 minCommon in Algorithms & data structures interviewsIndustries Software development

Question

A warehouse packs orders into boxes. Each box size holds an exact number of items — for example sizes [4, 6] — and every box you use must be completely full. You have unlimited boxes of each listed size (all distinct positive capacities). Given the sizes and a total item count, return the minimum number of boxes that pack all items exactly, or -1 if no exact packing exists. Zero items need 0 boxes. For example, sizes [4, 6] with 14 items pack as 4+4+6 using 3 boxes.

Implement
min_full_boxes(sizes: list[int], items: int) → int
Examples
in[[4,6],14]out3
in[[4,6],7]out-1
What a strong answer looks like

State 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.

Run or narrate your approach, then ask the coach.