Skip to content

Commit

Permalink
Merge pull request #312 from Rabbittee/feature/day39_Tim_solution
Browse files Browse the repository at this point in the history
add Tim's py solution
  • Loading branch information
beareatapple authored Aug 26, 2021
2 parents 1b0f933 + 9310356 commit a7b055b
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
7 changes: 7 additions & 0 deletions 2021-08/2021-08-26 (day39)/Tim/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#### Idea: Ways to climb (N) steps = to climb (N-1) steps + (N-2) steps. It's Fibonacci sequence.


![][fig]

[fig]:./fig/fig1.png

Binary file added 2021-08/2021-08-26 (day39)/Tim/fig/fig1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
11 changes: 11 additions & 0 deletions 2021-08/2021-08-26 (day39)/Tim/solution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
class Solution:
def climbStairs(self, n: int) -> int:

prev = 0
cur = 1
for i in range(n):
tmp = cur
cur = prev+cur
prev = tmp
return cur

0 comments on commit a7b055b

Please sign in to comment.