Notice
Recent Posts
Recent Comments
Link
«   2024/07   »
1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30 31
Archives
Today
Total
관리 메뉴

csct3434

[level 2] 2 x n 타일링 - 12900 본문

프로그래머스

[level 2] 2 x n 타일링 - 12900

csct3434 2024. 2. 28. 19:41
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];
    }
}