You are given an integer array coins representing coins of different denominations and an integer amount representing a total amount of money.

Return the number of combinations that make up that amount. If that amount of money cannot be made up by any combination of the coins, return 0.

You may assume that you have an infinite number of each kind of coin.

The answer is guaranteed to fit into a signed 32-bit integer.

&nbsp;
Example 1:

Input: amount = 5, coins = [1,2,5]
Output: 4
Explanation: there are four ways to make up the amount:
5=5
5=2+2+1
5=2+1+1+1
5=1+1+1+1+1


Example 2:

Input: amount = 3, coins = [2]
Output: 0
Explanation: the amount of 3 cannot be made up just with coins of 2.


Example 3:

Input: amount = 10, coins = [10]
Output: 1


&nbsp;
Constraints:


	1 &lt;= coins.length &lt;= 300
	1 &lt;= coins[i] &lt;= 5000
	All the values of coins are unique.
	0 &lt;= amount &lt;= 5000


dfs(total)
class Solution {
    public int coinChange(int[] coins, int amount) {
        int m=coins.length,n=amount;
        int dp[][]=new int[m+1][n+1];
        for(int j=0;j<=n;j++){
            dp[0][j]=0;
        }
          for(int i=0;i<=m;i++){
            dp[i][0]=0;
        }
        for(int i=1;i<=m;i++){
            for(int j=1;j<=n;j++){
               int t1 = Integer.MAX_VALUE;
        if ((i-1) == 0) {
            if (j % coins[i-1] == 0) {
                dp[i][j]= j / coins[i-1];
            } else {
                dp[i][j]= (int)1e9;
            }
        } 
        else {
            int t2 = dp[i-1][j];
        if (coins[i-1] <= j) {
            t1 = dp[i][j-coins[i-1]] + 1; 
        }
                dp[i][j]= Math.min(t1, t2);
        }
            }
        }
          if(dp[m][n]>=1e9)
        return -1;
        else
        return dp[m][n];
        }
    }
    
  
dfs(total)
dfs(total)
Coin Change