File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change 1
1
# Climbing Stairs Problem
2
2
3
+ ## Problem Description:
4
+
5
+ You are climbing a staircase. It takes ` n ` steps to reach the top.
6
+
7
+ Each time you can either climb 1 or 2 steps. In how many distinct ways can you climb to the top?
8
+
9
+ ### Example 1:
10
+ - ** Input:** n = 2
11
+ - ** Output:** 2
12
+ - ** Explanation:** There are two ways to climb to the top.
13
+ 1 . 1 step + 1 step
14
+ 2 . 2 steps
15
+
16
+ ### Example 2:
17
+ - ** Input:** n = 3
18
+ - ** Output:** 3
19
+ - ** Explanation:** There are three ways to climb to the top.
20
+ 1 . 1 step + 1 step + 1 step
21
+ 2 . 1 step + 2 steps
22
+ 3 . 2 steps + 1 step
23
+
24
+ ### Constraints:
25
+ - 1 <= n <= 45
26
+
3
27
## Problem Understanding:
4
28
5
29
In problems like the Climbing Stairs problem, I begin by creating a few test cases to identify the pattern and relationship between the steps.
You can’t perform that action at this time.
0 commit comments