Minimum box packing
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) → intExamples
in
[[4,6],14]out3in
[[4,6],7]out-1What 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.
0:00 of about 15 min
solution.py
InputExpectedGot
[[4,6],14]3not run yetsample[[4,6],7]-1not run yetsample