mirror of
https://github.com/krahets/hello-algo.git
synced 2026-07-11 15:06:07 +00:00
fix climbing_stairs_constraint_dp code
This commit is contained in:
@@ -7,7 +7,7 @@
|
||||
/* 带约束爬楼梯:动态规划 */
|
||||
func climbingStairsConstraintDP(n: Int) -> Int {
|
||||
if n == 1 || n == 2 {
|
||||
return n
|
||||
return 1
|
||||
}
|
||||
// 初始化 dp 表,用于存储子问题的解
|
||||
var dp = Array(repeating: Array(repeating: 0, count: 3), count: n + 1)
|
||||
|
||||
Reference in New Issue
Block a user