mirror of
https://github.com/krahets/hello-algo.git
synced 2025-11-02 21:24:53 +08:00
fix climbing_stairs_constraint_dp code
This commit is contained in:
@ -6,7 +6,7 @@
|
||||
|
||||
/* 带约束爬楼梯:动态规划 */
|
||||
fn climbing_stairs_constraint_dp(n: usize) -> i32 {
|
||||
if n == 1 || n == 2 { return n as i32 };
|
||||
if n == 1 || n == 2 { return 1 };
|
||||
// 初始化 dp 表,用于存储子问题的解
|
||||
let mut dp = vec![vec![-1; 3]; n + 1];
|
||||
// 初始状态:预设最小子问题的解
|
||||
|
||||
Reference in New Issue
Block a user