https://school.programmers.co.kr/learn/courses/30/lessons/12914
function solution (n) {
return fibonacci(n);
}
const fibonacci = (n) => {
const dp = new Array(n+1).fill(0);
dp[0] = 1; dp[1] = 1;
for(let i = 2; i <= n; i++)
dp[i] = (dp[i-1] + dp[i-2]) % 1234567;
return dp[n];
}
function solution(n) {
var answer = 0;
//팩토리얼 함수
function factorial(n) {
let result = 1;
for (let i = 1; i <= n; i++) {
result *= i;
}
return result;
}
if(n==1){
return 1;
}
let c=Math.floor(n/2);
//i는 2의 개수
for(let i=0;i<=c; i++){
answer+= factorial(n)/(factorial(i)*factorial(n-i));
n--;
}
return answer%1234567;
}```