# Min number of coins

We can take 1 denomination of 5, we'll need 6 - 5 = 1 to get the total. The minimum number of ways to get 1 using the coins of denomination 1 and 5 is stored in dp[. Choosing the better option in this problem equates to choosing the smaller of the two options. If the highest coin does not exceed the required sum, then we take. The minimum number of coins for a value V can be computed using below recursive formula. If V == 0, then 0 coins required. If V > 0 minCoins.
So the minimum number of coins required are 2, i. We'll choose the minimum of these two. This, unlike Dynamic Programming, is computationally expensive. For dp[1][6], we can make 6 in two ways: We take 6 denominations of coins[0], which is stored on the top. Finding the total number of possible ways a given sum can be made from a given set of coins. Recursive solution

*Min number of coins*key part of a solution, when using DP, is to implement the array to keep track of the solutions to subproblems.