Update 0070.爬楼梯.md

This commit is contained in:
QuinnDK 2021-05-13 09:43:05 +08:00 committed by GitHub
parent cf42d80efc
commit a14aafbaec
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 14 additions and 1 deletions

View File

@ -230,7 +230,20 @@ class Solution:
``` ```
Go Go
```Go
func climbStairs(n int) int {
if n==1{
return 1
}
dp:=make([]int,n+1)
dp[1]=1
dp[2]=2
for i:=3;i<=n;i++{
dp[i]=dp[i-1]+dp[i-2]
}
return dp[n]
}
```