We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
2 parents f27dc50 + 3f4a8e2 commit 760153fCopy full SHA for 760153f
climbing-stairs/mandel-17.py
@@ -0,0 +1,14 @@
1
+import collections
2
+
3
+class Solution:
4
+ num_dict = collections.defaultdict(int)
5
6
+ def climbStairs(self, n: int) -> int:
7
+ if n <= 2:
8
+ return n
9
10
+ if self.num_dict[n]:
11
+ return self.num_dict[n]
12
13
+ self.num_dict[n] = self.climbStairs(n-1) + self.climbStairs(n-2)
14
valid-anagram/mandel-17.py
0 commit comments