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.
1 parent 2217e31 commit 2831e27Copy full SHA for 2831e27
climbing-stairs/yayyz.py
@@ -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
17
class Solution:
18
def climbStairs(self, n: int) -> int:
19
if n <= 2:
0 commit comments