Search

2 x n 타일링

알고리즘
연습문제
플랫폼
프로그래머스
JCF
상태
해결
생성 일시
2024/01/25 07:18
최종 편집 일시
2024/01/25 09:05

문제 설명

해결과정

Solution.java

class Solution { public int solution(int n) { int answer = 0; int first = 1; int second = 2; int third = 0; int cnt = 3; while(cnt != n+1) { third = (first + second) % 1000000007; first = second%1000000007; second = third%1000000007; cnt++; } answer = third; return answer; } }
Java
복사