In a food court, there are food items and these can be bought using food coupons. The food court has some coupons of denominations like [1,4,10] and the food prices are like [5, 11] etc. so by combining the coupons you can buy the food items. Now, the food court has increased price of the maximum food item to P. Now, they want you to find the minimum number of coupon denominations to be added to the above denominations ([1, 4, 10]) so that every value in the range [1, P] can be created using these denominations.
Example -
Input:
3
1 4 10
P = 19
Solution:
If we add the coupon with denominations 2 and 5, we can make all values in the range [1, 19]
So the answer is 2
Constraints were again 106 for all the values.Code for this pls.
Comments (2)


