We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 5f17a29 commit d7bb3ceCopy full SHA for d7bb3ce
14. Questions/leetcode 70 - climbing stairs.py
@@ -0,0 +1,20 @@
1
+"""
2
+
3
+You are climbing a staircase. It takes n steps to reach the top.
4
5
+Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
6
7
+Question: https://leetcode.com/problems/climbing-stairs/
8
9
10
11
+class Solution:
12
+ def climbStairs(self, n: int) -> int:
13
+ one, two = 1,1
14
15
+ for i in range (n-1):
16
+ temp = one
17
+ one = one +two
18
+ two = temp
19
20
+ return one
0 commit comments