Domino and Tromino Tiling
MediumDynamic Programming
Decode it first. Clues, constraints, pattern and plan before any code.You want to cover a board that is 2 rows tall and n columns wide. You have unlimited 2 × 1 dominoes and L-shaped trominoes (three squares in an L), and you may rotate either piece. Return the number of ways to tile the whole board with no gaps or overlaps. Two tilings differ if some square is covered by a different piece. The count can be huge, so return it modulo 10^9 + 7.
n = 1 → 1
n = 2 → 2 (two vertical dominoes, or two horizontal ones)
n = 3 → 5
n = 4 → 11Constraints
1 <= n <= 1000