Skip to content

Commit 594b023

Browse files
committed
update
1 parent 1761b4f commit 594b023

File tree

1 file changed

+12
-17
lines changed

1 file changed

+12
-17
lines changed

climbing-stairs/EstherKim97.py

Lines changed: 12 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,18 @@ def climbStairs(self, n):
33

44
import math
55

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+
618
# Second method - n = 2x+y
719
if n % 2 == 0:
820
max = n //2
@@ -19,20 +31,3 @@ def climbStairs(self, n):
1931
total_methods += total_permu
2032

2133
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-

0 commit comments

Comments
 (0)