You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This discussion was converted from issue #21 on September 15, 2026 10:59.
Heading
Bold
Italic
Quote
Code
Link
Numbered list
Unordered list
Task list
Attach files
Mention
Reference
Menu
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Problem link
https://leetcode.com/problems/domino-and-tromino-tiling/
Problem Summary
2 * n 칸을 도미노와 트로미노 타일로 채울 수 있는 경우의 수를 구하는 문제.
Solution
전형적인 타일링 DP 문제. 1차원으로 되는 것 같은데 더 직관적인 2차원 배열로 풀었다.
그림으로 나타내면
이런 느낌이다.
그렇다면 점화식을 세울 수 있는데
dp[i][0] = dp[i - 2][0] + dp[i - 1][0] + dp[i - 1][1]
dp[i][1] = dp[i - 2][0] * 2 + dp[i - 1][1]
간단하게 설명해보면
dp[i][0] 에서
dp[i][1] 에서
1e9+7로 mod 연산하는 것만 붙여서 for문으로 돌려주면 된다.
Source Code
All reactions