Skip to content

Instantly share code, notes, and snippets.

@Desolve
Created July 5, 2019 08:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Desolve/36f7e5bd29cd65347e68e9617b6c8b30 to your computer and use it in GitHub Desktop.
Save Desolve/36f7e5bd29cd65347e68e9617b6c8b30 to your computer and use it in GitHub Desktop.
0070 Climbing Stairs
class Solution:
def climbStairs(self, n: 'int') -> 'int':
if n == 1:
return 1
if n == 2:
return 2
s1, s2 = 1, 2
for _ in range(n - 2):
s1, s2 = s2, s1 + s2
return s2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment