Data Structures & AlgorithmsVery hardGATE CS · ICPC regional

On a 1 × 9 strip of cells, you place 3 non-overlapping dominoes, each covering two adjacent cells. Two dominoes may not share a cell. How many placements are there (dominoes are identical, so only the set of covered cells matters)?

  1. A. 20
  2. B. 21
  3. C. 24
  4. D. 56

Correct answer: A. 20

Dominoes may sit next to each other but not overlap. Placing k = 3 dominoes among n − 2k = 3 free cells is choosing positions for 3 dominoes among n − k = 6 objects, giving C(6, 3) = 20. Picking any 3 of the 8 start cells, C(8, 3) = 56, wrongly allows overlapping dominoes.

More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions

Exams that ask this topic