Skip to content

Commit

Permalink
add white's solution
Browse files Browse the repository at this point in the history
  • Loading branch information
beareatapple committed Aug 26, 2021
1 parent 56195d6 commit 49ece15
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
6 changes: 6 additions & 0 deletions 2021-08/2021-08-26 (day39)/White/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# leetcode
Runtime: 43 ms, faster than 6.96% of Python3 online submissions for Climbing Stairs.
Memory Usage: 14.3 MB, less than 44.80% of Python3 online submissions for Climbing Stairs.

# fibonacci
https://en.wikipedia.org/wiki/Fibonacci_number
10 changes: 10 additions & 0 deletions 2021-08/2021-08-26 (day39)/White/climbing_stairs.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
class Solution:
def climbStairs(self, n: int) -> int:
if n <= 2:
return n

a, b, res = 1, 1, 2
for i in range(1, n-1):
a, b = b, res
res = a + b
return res

0 comments on commit 49ece15

Please sign in to comment.