Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f0a2e2b

Browse files
Update 070.py
1 parent 0b7eb29 commit f0a2e2b

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

‎001-500/070.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,11 @@ def climbStairs(self, n: int) -> int:
44
for i in range(2,n+2):
55
fib.append(fib[i-1]+fib[i-2])
66
return fib[n+1]
7+
8+
class Solution:
9+
def climbStairs(self, n: int) -> int:
10+
a,b=1,1
11+
while n>0:
12+
a,b = b,a+b
13+
n-=1
14+
return a

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /