Data Structures & AlgorithmsModerateTCS NQT · Infosys
Problem: In how many ways can a 1 × 7 strip be tiled completely with tiles of length 1, 2 and 3 (ordered arrangements of tiles count separately)?
- A. 44
- B. 24
- C. 81
- D. 8
Correct answer: A. 44
Tilings satisfy T(n) = T(n − 1) + T(n − 2) + T(n − 3) with T(0) = 1, giving 1, 1, 2, 4, 7, 13, 24, 44. An off-by-one gives T(6) = 24 or T(8) = 81, and counting unordered tile multisets gives 8.
More Coding Interview Problems questions
- Problem: A rope of integer length 10 is cut into integer pieces (at least two pieces), and the product of the piece lengths is maximised…
- Problem: How many binary strings of length 6 contain neither the substring "00" nor "11"?
- Problem: The number of partitions of 12 into parts of size at most 4 (order of parts does not matter) is what value?
- Problem: The longest palindromic subsequence of "character" has what length?
- Problem: Ropes of lengths 4, 3, 2 and 6 are joined pairwise; joining two ropes costs the sum of their lengths, and the next join uses the…
- Problem: How many integers n with 1 ≤ n ≤ 100 have a binary representation that reads the same forwards and backwards?