Data Structures & AlgorithmsModerateTCS NQT · CAT

Problem: The number of ways to tile a 1×4 strip completely using tiles of length 1 and length 2 (tiles of the same length are indistinguishable, and different orders count separately) is what value?

  1. A. 6
  2. B. 4
  3. C. 7
  4. D. 5

Correct answer: D. 5

Tilings follow the Fibonacci recurrence f(n) = f(n−1) + f(n−2), giving 1, 1, 2, 3, 5 for n = 0 to 4. The answer is five.

More Coding Interview Problems questions

Exams that ask this topic