Skip to content

Commit 3013ae5

Browse files
line break + 설명 추가
1 parent 12c2d8f commit 3013ae5

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

climbing-stairs/jaejeong1.java

+8-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
class SolutionClimbStairs {
22

33
public int climbStairs(int n) {
4+
// n번째 계단까지 오르는 방법의 수
5+
// 첫 번째 계단까지 오르는 방법은 1가지
6+
// 두 번째 계단까지 오르는 방법은 2가지
7+
// 세 번째 계단부터는 이전 두 계단의 방법을 더하여 계산
8+
// stairs[i]는 i번째 계단까지 오르는 방법의 수
9+
// 시간복잡도: O(N), 공간복잡도: O(N)
410
if (n == 1) {
511
return 1;
612
}
@@ -13,10 +19,11 @@ public int climbStairs(int n) {
1319
stairs[1] = 1;
1420
stairs[2] = 2;
1521

22+
1623
for (int i=3; i<=n; i++) {
1724
stairs[i] = stairs[i-1] + stairs[i-2];
1825
}
1926

2027
return stairs[n];
2128
}
22-
}
29+
}

product-of-array-except-self/jaejeong1.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,4 @@ public int[] productExceptSelf(int[] nums) {
3131

3232
return answer;
3333
}
34-
}
34+
}

two-sum/jaejeong1.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,4 @@ public int[] twoSum(int[] nums, int target) {
3333
// 쌍을 찾지 못한 경우
3434
return null;
3535
}
36-
}
36+
}

0 commit comments

Comments
 (0)