Skip to content

Commit 6dfb874

Browse files
committed
Fix: add type hints and doctests for Climbing Stairs
1 parent ef06b3d commit 6dfb874

File tree

1 file changed

+0
-25
lines changed

1 file changed

+0
-25
lines changed
Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1 @@
1-
"""
2-
Climbing Stairs Problem
3-
LeetCode #70
4-
Author: Noorin Rahila
5-
"""
6-
7-
class Solution:
8-
def climbStairs(self, n: int) -> int:
9-
a = 1
10-
b = 1
11-
if n == 0:
12-
return 0
13-
elif n == 1:
14-
return 1
15-
else:
16-
for i in range(1, n):
17-
c = a + b
18-
a = b
19-
b = c
20-
return b
21-
22-
# Example usage
23-
if __name__ == "__main__":
24-
s = Solution()
25-
print(s.climbStairs(5)) # Output: 8
261

0 commit comments

Comments
 (0)