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

Commit bcfa920

Browse files
committed
Update 0518.零钱兑换2,添加C#
1 parent fddab1a commit bcfa920

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

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

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -347,6 +347,26 @@ object Solution {
347347
}
348348
}
349349
```
350+
### C#
351+
```csharp
352+
public class Solution
353+
{
354+
public int Change(int amount, int[] coins)
355+
{
356+
int[] dp = new int[amount + 1];
357+
dp[0] = 1;
358+
for (int i = 0; i < coins.Length; i++)
359+
{
360+
for (int j = coins[i]; j <= amount; j++)
361+
{
362+
if (j >= coins[i])
363+
dp[j] += dp[j - coins[i]];
364+
}
365+
}
366+
return dp[amount];
367+
}
368+
}
369+
```
350370

351371
<p align="center">
352372
<a href="https://programmercarl.com/other/kstar.html" target="_blank">

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /