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 a1e3845 commit 26d68fcCopy full SHA for 26d68fc
climbing-stairs/printjin-gmailcom.py
@@ -0,0 +1,8 @@
1
+class Solution:
2
+ def climbStairs(self, n: int):
3
+ if n <= 2:
4
+ return n
5
+ a, b = 1, 2
6
+ for _ in range(3, n+1):
7
+ a, b = b, a + b
8
+ return b
0 commit comments