From c19fcf588dd4c07c60de90122a2196b4ebb80e50 Mon Sep 17 00:00:00 2001 From: QuinnDK <39618652+QuinnDK@users.noreply.github.com> Date: Thu, 13 May 2021 09:43:05 +0800 Subject: [PATCH] =?UTF-8?q?Update=200070.=E7=88=AC=E6=A5=BC=E6=A2=AF.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- problems/0070.爬楼梯.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/problems/0070.爬楼梯.md b/problems/0070.爬楼梯.md index 6ae6adc7..f0a08f99 100644 --- a/problems/0070.爬楼梯.md +++ b/problems/0070.爬楼梯.md @@ -230,7 +230,20 @@ class Solution: ``` 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] +} +```