dp
of size amount + 1
and set dp[0] = 1
(base case: there's one way to make up amount 0).coins
.amount
.j
, update dp[j]
by adding dp[j - coin]
to it. This represents using the current coin to make up the amount j
.dp[amount]
which contains the number of combinations to make up the desired amount.