728x90
반응형
문제
반응형
풀이
1
2
3
4
5
6
7
8
9
10
11
12
13
|
class Solution {
public int climbStairs(int n) {
if(n == 1) return 1;
int[] arr = new int[n+1];
arr[1]=1;
arr[2]=2;
for(int i=3; i<=n; i++) {
arr[i]=arr[i-1]+arr[i-2];
}
return arr[n];
}
}
|
cs |
728x90
반응형
'[JAVA] LeetCode > Easy' 카테고리의 다른 글
[LeetCode/릿코드] 118. Pascal's Triangle (0) | 2023.01.24 |
---|---|
[LeetCode/릿코드] 88. Merge Sorted Array (0) | 2023.01.24 |
[LeetCode/릿코드] 69. Sqrt(x) (0) | 2023.01.24 |
[LeetCode/릿코드] 67. Add Binary (0) | 2023.01.24 |
[LeetCode/릿코드] 66. Plus One (0) | 2023.01.24 |