Count the number of ways to fully tile a board using dominoes and trominoes.
You are given an integer . Consider a board. You may place the following tiles:
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 .
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
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.