You have two kinds of tiles: a 2 x 1 domino and an L-shaped tromino, and both may be rotated. Given n, return the number of ways to tile a 2 x n board, modulo 10^9 + 7. Two tilings differ if some pair of 4-directionally adjacent cells is covered by one tile in one tiling and not in the other.
You have two kinds of tiles: a 2 x 1 domino and an L-shaped tromino, and both may be rotated. Given n, return the number of ways to tile a 2 x n board, modulo 10^9 + 7. Two tilings differ if some pair of 4-directionally adjacent cells is covered by one tile in one tiling and not in the other.
Example 1:
Input: {"n":3}
Output: 5
Constraints:
1≤n≤1000
Test Cases
Input (Stdin)
Expected Output (Stdout)
Execution Result
Run code to see results.
Input
arr ={"n":3}
Count the ways to tile a 2 x 3 board with dominoes and L-trominoes. Counts grow fast, so everything is taken mod 1e9+7.