Skip to content

Commit 2831e27

Browse files
committed
added description
1 parent 2217e31 commit 2831e27

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

climbing-stairs/yayyz.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
"""
2+
📝 Problem: LeetCode 70 - Climbing Stairs
3+
📅 Date: 2025-04-07
4+
5+
🚀 Approach:
6+
- Bottom-up DP using an array
7+
- dp[i] = dp[i-1] + dp[i-2]
8+
9+
⏱️ Time Complexity: O(n)
10+
💾 Space Complexity: O(n)
11+
12+
📌 Notes:
13+
- Base case: dp[0] = 1, dp[1] = 1
14+
- dp[i]: i번째 계단으로 도달하기 위한 모든 경우의 수를 가짐
15+
- n <= 2의 경우는 f(1) + f(0)이 합해진 경우이기 때문에 n을 반환
16+
"""
117
class Solution:
218
def climbStairs(self, n: int) -> int:
319
if n <= 2:

0 commit comments

Comments
 (0)