Problem
You have a board with 2 rows and n columns. You also have two types of tiles. A domino is a 2 x 1 tile that covers 2 cells. A tromino is an L-shaped tile that covers 3 cells. You can turn both types of tiles in any direction.
A tiling covers every cell of the board with tiles, and no two tiles overlap. Neighboring cells are two cells that share a side.
Two tilings are different when one tiling covers two neighboring cells with one tile and the other tiling covers them with two tiles.
Return the number of different tilings of the board. The number can be very large, so return the remainder of the number divided by 10^9 + 7.
Example 1
- Input:
- n = 2
- Output:
- 2
- Explanation:
- You can put two dominoes side by side in vertical position, or one above the other in horizontal position.
Example 2
- Input:
- n = 4
- Output:
- 11
Example 3
- Input:
- n = 5
- Output:
- 24
Constraints
- 1 <= n <= 1000
SysRound wrote this statement. A reference solution checks every example.
Related questions
Continue with questions that share topics or the same question type.
- Beautiful Arrangement
Coding · Array · Backtracking · Bit Manipulation
- Best Time to Buy and Sell Stock
Coding · Array · Dynamic Programming
- Best Time to Buy and Sell Stock II
Coding · Array · Dynamic Programming · Greedy
- Binary Tree Cameras
Coding · Binary Tree · Depth-First Search · DP on Trees
Sources · 2 references
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 790. Domino and Tromino Tiling
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source
LeetCode company tags · 2 records
Goldman Sachs
Domino and Tromino Tiling
Reported date not specified · Source window: 3mo
Source snapshot: Oct 20, 2026
Source frequency score: 77.9. This is not an interview probability.
View sourceGoldman Sachs
Domino and Tromino Tiling
Reported date not specified · Source window: 6mo
Source snapshot: Oct 20, 2026
Source frequency score: 67.8. This is not an interview probability.
View source