A pharmaceutical company prepares liquid medication for multiple patients. Each patient order has a required volume. The company can choose one “container set” to fulfill all orders. A container set contains multiple available container capacities.
For an order with requirement r using a chosen container set:
r
exists, use it (waste = 0).
c
such that
c >= r
.
c - r
.
>= r
for any order, that container set is
invalid
and cannot be chosen.
Given:
requirements[]
: volumes required for each order (patients)
containerSets
: a list where
containerSets[i]
is an array of container capacities available in set
i
Compute the total waste for each valid set (sum of wastes across all orders). Return:
-1
requirements
(length
m
), and
containerSets
(length
s
, each set has one or more capacities)
-1