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?
- A. 6
- B. 4
- C. 7
- 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
- Problem: In the binary string "0011100", what is the length of the longest contiguous substring that contains equal numbers of 0s and 1s?
- Problem: How many strings of length 3 over the alphabet {a, b, c} contain no two consecutive a's?
- Problem: The number of subsets of {1, 2, 3, 4} whose elements sum to exactly 5 (the empty set is excluded) is what value?
- Problem: The number of ways to make 15 using coins of values 2, 3 and 5, where the order of coins does not matter, is what value?
- Problem: The sum of the numbers obtained by repeatedly removing the first and last elements of [1, 2, 3, 4, 5, 6, 7, 8] and adding them as…
- Problem: What is the remainder when 2^100 is divided by 9?