Tile 2xn board
You have an unlimited supply of 2x1 dominoes and L-shaped trominoes (a tromino covers three cells in an L). Count the number of ways to fully tile a 2 x n board; two tilings are different if some cell is covered by a different shape. Because the count grows fast, return the answer modulo 1_000_000_007. Assume 0 <= n <= 1000.
Implement
num_tilings(n: int) → intExamples
in
[3]out5What a strong answer looks like
State your approach and its time/space complexity out loud before you optimize. Handle the edge cases (empty input, duplicates, overflow), and say why you chose this over the brute force. Green tests are the floor, not the grade.
0:00 of about 25 min
solution.py
InputExpectedGot
[3]5not run yetsample