Update 0518.零钱兑换2,添加C#

This commit is contained in:
eeee0717
2024-01-21 10:29:39 +08:00
parent fddab1a7f4
commit bcfa9202eb

View File

@ -347,6 +347,26 @@ object Solution {
}
}
```
### C#
```csharp
public class Solution
{
public int Change(int amount, int[] coins)
{
int[] dp = new int[amount + 1];
dp[0] = 1;
for (int i = 0; i < coins.Length; i++)
{
for (int j = coins[i]; j <= amount; j++)
{
if (j >= coins[i])
dp[j] += dp[j - coins[i]];
}
}
return dp[amount];
}
}
```
<p align="center">
<a href="https://programmercarl.com/other/kstar.html" target="_blank">