Merge pull request #375 from haofengsiji/update

Update 0070.爬楼梯完全背包版本.md
This commit is contained in:
程序员Carl
2021-06-11 15:34:28 +08:00
committed by GitHub

View File

@ -147,6 +147,23 @@ class Solution {
Python
```python3
class Solution:
def climbStairs(self, n: int) -> int:
dp = [0]*(n + 1)
dp[0] = 1
m = 2
# 遍历背包
for j in range(n + 1):
# 遍历物品
for step in range(1, m + 1):
if j >= step:
dp[j] += dp[j - step]
return dp[n]
```
Go
```go