Interview Questions/Coding/Ways to Tile the Parade Stage

Ways to Tile the Parade Stage

Preview mode. Log in to edit, run, submit, and save progress.

Medium

Ways to Tile the Parade Stage

A parade stage has 2 rows and n columns. You may cover it using 2 x 1 domino boards and L-shaped tromino boards. Boards may be rotated, and every cell must be covered exactly once. Return the number of tilings modulo 10^9 + 7.

Examples

Example 1
Input:
n = 1
Output:
1

Approach hint

Track full and partial coverings.

Common mistake

Skipping assumptions, edge cases, or trade-offs can make an otherwise good answer feel incomplete.

solution.cpp