Add solution 0279、0518

This commit is contained in:
halfrost
2021-06-16 17:38:56 +08:00
parent 48cb642554
commit 5cf1b806b1
23 changed files with 507 additions and 44 deletions

View File

@ -0,0 +1,12 @@
package leetcode
func change(amount int, coins []int) int {
dp := make([]int, amount+1)
dp[0] = 1
for _, coin := range coins {
for i := coin; i <= amount; i++ {
dp[i] += dp[i-coin]
}
}
return dp[amount]
}