Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c7bed2b

Browse files
feat: 2 / 3 x n 타일링 / 새로운 문제
1 parent 9bb46e0 commit c7bed2b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

‎level-2/3-x-n-타일링.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//https://github.com/codeisneverodd/programmers-coding-test
2+
//더 좋은 풀이가 존재할 수 있습니다.
3+
//정답 1 - codeisneverodd
4+
function solution(n) {
5+
if (n % 2 !== 0) return 0;
6+
7+
const getCount = n => {
8+
const k = n / 2;
9+
const count = [3, 11, ...Array(k - 2)];
10+
const divider = 1000000007;
11+
for (let i = 2; i < k; i++) {
12+
count[i] = (4 * count[i - 1] - count[i - 2] + divider) % divider;
13+
}
14+
return count[count.length - 1];
15+
};
16+
17+
return getCount(n);
18+
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /