diff --git a/problems/0518.零钱兑换II.md b/problems/0518.零钱兑换II.md index 5c6efdcb..9fbe8ba3 100644 --- a/problems/0518.零钱兑换II.md +++ b/problems/0518.零钱兑换II.md @@ -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]; + } +} +```