mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-10 22:46:07 +00:00
fix(csharp): Modify method name to PascalCase, simplify new expression (#840)
* Modify method name to PascalCase(array and linked list) * Modify method name to PascalCase(backtracking) * Modify method name to PascalCase(computational complexity) * Modify method name to PascalCase(divide and conquer) * Modify method name to PascalCase(dynamic programming) * Modify method name to PascalCase(graph) * Modify method name to PascalCase(greedy) * Modify method name to PascalCase(hashing) * Modify method name to PascalCase(heap) * Modify method name to PascalCase(searching) * Modify method name to PascalCase(sorting) * Modify method name to PascalCase(stack and queue) * Modify method name to PascalCase(tree) * local check
This commit is contained in:
@@ -8,7 +8,7 @@ namespace hello_algo.chapter_dynamic_programming;
|
||||
|
||||
public class coin_change_ii {
|
||||
/* 零钱兑换 II:动态规划 */
|
||||
public int coinChangeIIDP(int[] coins, int amt) {
|
||||
public int CoinChangeIIDP(int[] coins, int amt) {
|
||||
int n = coins.Length;
|
||||
// 初始化 dp 表
|
||||
int[,] dp = new int[n + 1, amt + 1];
|
||||
@@ -32,7 +32,7 @@ public class coin_change_ii {
|
||||
}
|
||||
|
||||
/* 零钱兑换 II:空间优化后的动态规划 */
|
||||
public int coinChangeIIDPComp(int[] coins, int amt) {
|
||||
public int CoinChangeIIDPComp(int[] coins, int amt) {
|
||||
int n = coins.Length;
|
||||
// 初始化 dp 表
|
||||
int[] dp = new int[amt + 1];
|
||||
@@ -58,11 +58,11 @@ public class coin_change_ii {
|
||||
int amt = 5;
|
||||
|
||||
// 动态规划
|
||||
int res = coinChangeIIDP(coins, amt);
|
||||
int res = CoinChangeIIDP(coins, amt);
|
||||
Console.WriteLine("凑出目标金额的硬币组合数量为 " + res);
|
||||
|
||||
// 空间优化后的动态规划
|
||||
res = coinChangeIIDPComp(coins, amt);
|
||||
res = CoinChangeIIDPComp(coins, amt);
|
||||
Console.WriteLine("凑出目标金额的硬币组合数量为 " + res);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user