# Coin Change Problem

`Input: coins = [1,2,5], amount = 11Output: 3Explanation: 11 = 5 + 5 + 1`
`Input: coins = , amount = 3Output: -1`
`Input: coins = , amount = 0Output: 0`
`Input: coins = , amount = 1Output: 1`
`Input: coins = , amount = 2Output: 2`
• `1 <= coins.length <= 12`
• `1 <= coins[i] <= 231 - 1`
• `0 <= amount <= 104`
`public class Solution {    public int CoinChange(int[] coins, int amount) {        // Create an DP array where we will store the solution of  subproblem from  bottom-up  approach.        // As it will have value for 0 also so we will have  Amount+1 length;        int[] dp = new int[amount + 1];             // Initialize the DP array with sum dummy value.        for(int i = 0 ; i < dp.Length ;i++)        {            dp[i] = -99;  // You can initialize with any value greater than the "amount" value.        }        dp = 0;        for(int i = 1 ; i < amount+1 ; i++)        {            for(int  j = 0 ; j < coins.Length ; j++)            {                if( i-coins[j] >=0)                {                    dp[i] = Math.Min(dp[i], 1 + dp[i-coins[j]]);                }            }        }        return dp[amount] == -99 ? -1:dp[amount];    }}`

--

--