Your purse has N distinct denominations for buying things. You are given the denominations in the array A. You have an infinite amount of each denomination available with you because you are very rich. You went to a theatre to buy a movie ticket. You don’t know the exact price of the ticket, just that it can cost anything from 1 to X inclusive. Since you hate change, you want to make sure that you can pay for the ticket without having to haggle for change. How many ticket prices from 1 to X can you buy without having to haggle for change?
Sample Input 1:
Sample Output 1:
how to solve this but contraint is high while using unbounder knapsack