fix climbing_stairs_constraint_dp code

This commit is contained in:
krahets
2023-08-31 02:31:58 +08:00
parent 628d8a516b
commit a47a974a6a
11 changed files with 11 additions and 11 deletions

View File

@ -8,7 +8,7 @@ Author: Krahets (krahets@163.com)
def climbing_stairs_constraint_dp(n: int) -> int:
"""带约束爬楼梯:动态规划"""
if n == 1 or n == 2:
return n
return 1
# 初始化 dp 表,用于存储子问题的解
dp = [[0] * 3 for _ in range(n + 1)]
# 初始状态:预设最小子问题的解