ProgrammingHardGATE CS · Campus placements

The number of ways to tile a 2 x 6 board with 2 x 1 dominoes equals the number of binary tilings given by T(n) = T(n-1) + T(n-2) with T(1) = 1 and T(2) = 2. What is T(6)?

  1. A. 8
  2. B. 13
  3. C. 21
  4. D. 12

Correct answer: B. 13

The values are T(1) = 1, T(2) = 2, T(3) = 3, T(4) = 5, T(5) = 8, T(6) = 13. A loop computes this in O(n) time and O(1) space, while naive recursion repeats work.

More C Programming questions

Exams that ask this topic