Update knapsack_problem and intro_to_dp

Fix avl_tree
This commit is contained in:
krahets
2023-07-09 02:39:58 +08:00
parent cbfb9e59ad
commit cddddb8b8b
17 changed files with 61 additions and 48 deletions

View File

@ -12,7 +12,7 @@ public class climbing_stairs_constraint_dp {
if (n == 1 || n == 2) {
return n;
}
// 初始化 dp 表,用于存储子问题的解
// 初始化 dp 表,用于存储子问题的解
int[][] dp = new int[n + 1][3];
// 初始状态:预设最小子问题的解
dp[1][1] = 1;

View File

@ -11,7 +11,7 @@ public class climbing_stairs_dp {
public static int climbingStairsDP(int n) {
if (n == 1 || n == 2)
return n;
// 初始化 dp 表,用于存储子问题的解
// 初始化 dp 表,用于存储子问题的解
int[] dp = new int[n + 1];
// 初始状态:预设最小子问题的解
dp[1] = 1;

View File

@ -14,7 +14,7 @@ public class min_cost_climbing_stairs_dp {
int n = cost.length - 1;
if (n == 1 || n == 2)
return cost[n];
// 初始化 dp 表,用于存储子问题的解
// 初始化 dp 表,用于存储子问题的解
int[] dp = new int[n + 1];
// 初始状态:预设最小子问题的解
dp[1] = cost[1];