File tree Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Expand file tree Collapse file tree 1 file changed +12
-17
lines changed Original file line number Diff line number Diff line change @@ -3,6 +3,18 @@ def climbStairs(self, n):
3
3
4
4
import math
5
5
6
+ # First attempt to this question.
7
+ # Get dividend and remainder of 2 steps & get all combinations & add one additional method for all 1 step combination
8
+ # But how to get all combinations? => permutation
9
+ # def climbStairs(self, n):
10
+ # # 2 steps
11
+ # two_steps = n // 2
12
+ # two_steps_remainder = n % 2
13
+ # total_steps = two_steps + two_steps_remainder
14
+ # total_permu = math.factorial(total_steps) // (math.factorial(two_steps) * math.factorial(two_steps_remainder))
15
+ # total_permu += 1
16
+ # return total_permu
17
+
6
18
# Second method - n = 2x+y
7
19
if n % 2 == 0 :
8
20
max = n // 2
@@ -19,20 +31,3 @@ def climbStairs(self, n):
19
31
total_methods += total_permu
20
32
21
33
return total_methods
22
-
23
-
24
- # First attempt to this question.
25
- # Get dividend and remainder of 2 steps & get all combinations & add one additional method for all 1 step combination
26
- # But how to get all combinations? => permutation
27
- # def climbStairs(self, n):
28
- # # 2 steps
29
- # two_steps = n // 2
30
- # two_steps_remainder = n % 2
31
-
32
- # total_steps = two_steps + two_steps_remainder
33
-
34
- # total_permu = math.factorial(total_steps) // (math.factorial(two_steps) * math.factorial(two_steps_remainder))
35
- # total_permu += 1
36
-
37
- # return total_permu
38
-
You can’t perform that action at this time.
0 commit comments