Microsoft[Jan 2021} find out Minimum cuts for Breads

Bread factory have X number of length Breads and customers wants Y numbers of length Breads, Factory is commited to supply correct number of length breads to customer with minimum CUTS on Breads.
Example :
(1) Breads with length {4,5,2} and 5 customers wants breads with length {2,4,1,1,1} can solve with 3 cuts in bread.
(2) Breads with length {7,2,5} and 4 customers wants breads length {1,3,2,4} can solve with minimum 2 cuts.
Write a program to distribute breads to customer with minimum cuts.
consider X , Y > 0.

Comments (3)