⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 18m 45s17 days 22 hours 18 minutes 45 seconds.
⚡ Build the skills to land top-paying quant jobs. Offer ends in 17d 22h 18m 45s17 days 22 hours 18 minutes 45 seconds.

Sign in to watch this lesson
Advanced - Dynamic Programming · 4:01
To count the domino tilings of a board, we sweep it column by column and remember only a bitmask profile: which cells just past the frontier are already covered by dominoes poking across it. Filling each column from top to bottom gives the transitions, the table dp[column][mask] counts the 11 tilings of a 3 × 4 board, and moving the frontier one cell at a time (the broken profile) brings the work down to n·m·2ᵐ.