Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

In how many ways can a 3 × 8 rectangle be tiled exactly with 2 × 1 dominoes (horizontal or vertical)?

  1. A. 41
  2. B. 306
  3. C. 162
  4. D. 153

Correct answer: D. 153

Let f(n) be the number of tilings of a 3 × 2n board: with f(0) = 1 and f(1) = 3, the recurrence f(n) = 4f(n−1) − f(n−2) holds, since the transfer structure of the boundary gives exactly these two new patterns. Doubling the count mirrors the board and is a common error.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic