Skip to content

Commit

Permalink
Create climbing-stairs.py
Browse files Browse the repository at this point in the history
Uses dynamic programming to work out this is essentially the fibbonacci sequence, then computes as such
  • Loading branch information
gabedonnan authored Jan 12, 2023
1 parent 156ab64 commit c381403
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions climbing-stairs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import math
class Solution(object):
def climbStairs(self, n):
"""
:type n: int
:rtype: int
"""
l, r = 1, 1
for i in range(n):
temp = l + r
l = r
r = temp
return l

0 comments on commit c381403

Please sign in to comment.