mirror of
https://github.com/krahets/hello-algo.git
synced 2025-12-19 07:17:54 +08:00
fix climbing_stairs_constraint_dp code
This commit is contained in:
@@ -7,7 +7,7 @@ package chapter_dynamic_programming
|
||||
/* 带约束爬楼梯:动态规划 */
|
||||
func climbingStairsConstraintDP(n int) int {
|
||||
if n == 1 || n == 2 {
|
||||
return n
|
||||
return 1
|
||||
}
|
||||
// 初始化 dp 表,用于存储子问题的解
|
||||
dp := make([][3]int, n+1)
|
||||
|
||||
Reference in New Issue
Block a user