Skip to content

Commit e430747

Browse files
authored
Merge pull request #1152 from ivan1016017/january14
adding climbing stairs algo
2 parents 3843c45 + 5c38711 commit e430747

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
from typing import List, Union, Collection, Mapping, Optional
2+
from abc import ABC, abstractmethod
3+
4+
class Solution:
5+
def climbStairs(self, n: int) -> int:
6+
7+
a, b = 1, 1
8+
9+
for i in range(n):
10+
a, b = b, a + b
11+
12+
return a
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import unittest
2+
from src.my_project.interviews.top_150_questions_round_12\
3+
.climbing_stairs import Solution
4+
5+
class ClimbingStairsTestCase(unittest.TestCase):
6+
7+
def test_climbing_stairs(self):
8+
solution = Solution()
9+
output = solution.climbStairs(n=3)
10+
target = 3
11+
self.assertEqual(output, target)
12+
13+

0 commit comments

Comments
 (0)