We install marble countertops. The marble comes in a standard width but varying
lengths. It is very difficult to cut the marble -- we have a special machine
that cuts
a length of marble into two pieces, one of which must be exactly k feet long. A piece
that is no bigger than k cannot be cut.
int[] stock contains the lengths of marble that we have on hand, and int[]
orders contains the lengths that our customers have ordered. Given k, stock,
and orders, return the minimum number of cuts
needed to satisfy all our customers. If it is not possible, return -1.
|