Skip to content

Commit

Permalink
멀리 뛰기
Browse files Browse the repository at this point in the history
  • Loading branch information
dudwns committed Jun 13, 2023
1 parent 0a22242 commit 9de7f33
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions Programmers/exam88.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// n이 1일때 = 방법은 1개
// n이 2일때 = 방법은 2개
// n이 3일때 = 방법은 3개
// n이 4일때 = 방법은 5개
// n이 5일때 = 방법은 8개
// 피보나치 수열

function solution(n) {
const dp = [];
dp[0] = 1;
dp[1] = 1;

for (let i = 2; i <= n; i++) {
dp[i] = (dp[i - 2] + dp[i - 1]) % 1234567;
}
return dp[n];
}

0 comments on commit 9de7f33

Please sign in to comment.