Data Structures & AlgorithmsVery hardGATE CS
A 2 × 11 board is tiled completely using 1 × 2 dominoes (placed either way) and 2 × 2 squares. How many different tilings are there?
- A. 1366
- B. 1194
- C. 1365
- D. 1024
Correct answer: C. 1365
Considering the last column: a vertical domino leaves a 2 × 10 board and either two horizontal dominoes or a 2 × 2 square leave a 2 × 9 board, so T(n)=T(n−1)+2T(n−2), T(0)=T(1)=1 (Jacobsthal numbers). This gives T(11)=1365.
More Coding Interview Problems questions
- The 3 × 3 grid graph (9 vertices, 12 edges) has a diagonal edge added between its top-left corner and its centre vertex, giving a 13-edge…
- 50 people stand in a circle numbered 1 to 50. Starting the count at person 1, every 7th person (counting the first as 1) is removed, and…
- How many subsets of {1, 2, ..., 15} (including the empty set) contain no two consecutive integers and have an even sum?
- How many integers n with 1 <= n <= 100000 are divisible by exactly one of the numbers 6, 10 and 15?
- How many primes p < 500 have p - 2 or p + 2 also prime (that is, belong to at least one twin-prime pair, counted as individual primes)?
- 0/1 knapsack with capacity 27: weights [13, 8, 9, 14, 12, 4, 11] and values [25, 19, 16, 27, 22, 8, 23] (item i has weight w[i] and value…