Update 0070.爬楼梯完全背包版本.md

Added python version code
This commit is contained in:
LiangDazhu
2021-06-11 00:33:03 +08:00
committed by GitHub
parent da57f5123b
commit 7b6223f7d9

View File

@ -146,7 +146,18 @@ class Solution {
```
Python
```python
class Solution:
def climbStairs(self, n: int) -> int:
m = 2
dp = [0] * (n + 1)
dp[0] = 1
for i in range(n + 1):
for j in range(1, m + 1):
if i >= j:
dp[i] += dp[i - j]
return dp[-1]
```
Go
```go