csct3434
[level 2] 2 x n 타일링 - 12900 본문
class Solution {
public int solution(int n) {
int[] dp = new int[n+1];
dp[1] = 1;
dp[2] = 2;
for (int i = 3; i <= n; i++) {
dp[i] = (dp[i - 1] + dp[i - 2]) % 1000000007;
}
return dp[n];
}
}
'프로그래머스' 카테고리의 다른 글
[level 2] 가장 큰 정사각형 찾기 - 12905 (0) | 2024.02.28 |
---|---|
[level 2] 3 x n 타일링 - 12902 (0) | 2024.02.28 |
[level 2] 124 나라의 숫자 - 12899 (0) | 2024.02.28 |
[level 2] 게임 맵 최단거리 - 1844 (0) | 2024.02.28 |
[level 2] 단체사진 찍기 - 1835 (0) | 2024.02.28 |