Back to problems Sign in to unlock
Leetcode
Medium
Dynamic Programming
Combinatorics
Arrays
Domino And Tromino Tiling
Count the number of ways to fully tile a board using dominoes and trominoes.
Acceptance 0%
Problem Statement
You are given an integer . Consider a board. You may place the following tiles:
- A domino, which can be placed vertically.
- A domino, which can be placed horizontally.
- An L-shaped tromino that covers exactly 3 cells and may be rotated in any direction.
Return the number of ways to completely cover the board with no overlaps and no uncovered cells.
Because the answer can be very large, return it modulo .
Input Format
- A single integer representing the board width.
Output Format
- Return an integer: the number of valid tilings of a board modulo .
Constraints
- The result should be computed modulo .
- Use an approach that scales to large rather than brute force enumeration.
Examples
Sample cases returned by the problem API.
Example 1
Input
n = 3
Output
5
Explanation
There are 5 tilings of a board using the allowed tiles.
Example 2
Input
n = 4
Output
11
Explanation
There are 11 valid tilings of a board.
Premium problem context
Unlock deeper context for this problem
Premium adds guided hints, editorial links, similar variants, discussion resources, and concept maps so you can understand why a problem matters, not just solve it once.
Guided hints
Editorial and discussion links
Concept map and variants
Track your progress
Sign in to bookmark this problem, save notes, and manage its revision plan.