Merge branch 'youngyangyang04:master' into master

This commit is contained in:
lichun-chen 2021-07-08 10:54:36 -05:00 committed by GitHub
commit de4e13fe4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -243,6 +243,22 @@ func change(amount int, coins []int) int {
}
```
Javascript
```javascript
const change = (amount, coins) => {
let dp = Array(amount + 1).fill(0);
dp[0] = 1;
for(let i =0; i < coins.length; i++) {
for(let j = coins[i]; j <= amount; j++) {
dp[j] += dp[j - coins[i]];
}
}
return dp[amount];
}
```
-----------------------