Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit97636cc

Browse files
Merge pull requestyoungyangyang04#470 from jackeyjia/patch-4
add js solution for coin-change-2
2 parents4598c47 +01ee8a2 commit97636cc

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

‎problems/0518.零钱兑换II.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,22 @@ func change(amount int, coins []int) int {
243243
}
244244
```
245245

246+
Javascript:
247+
```javascript
248+
constchange= (amount,coins)=> {
249+
let dp=Array(amount+1).fill(0);
250+
dp[0]=1;
251+
252+
for(let i=0; i<coins.length; i++) {
253+
for(let j= coins[i]; j<= amount; j++) {
254+
dp[j]+= dp[j- coins[i]];
255+
}
256+
}
257+
258+
return dp[amount];
259+
}
260+
```
261+
246262

247263

248264
-----------------------

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp