Data Structures & AlgorithmsHardICPC regional · GATE CS

Problem: A set of 10 people is divided into 5 pairs. How many distinct ways are there to form these pairs (unordered pairs, unordered collection of pairs)?

  1. A. 113400
  2. B. 45
  3. C. 945
  4. D. 30240

Correct answer: C. 945

Perfect matchings of 10 people: 9 · 7 · 5 · 3 · 1 = 945 (= 10!/(2⁵ · 5!)). Not dividing by 5! gives 113400, one pair alone gives C(10,2) = 45, and 10!/5! = 30240 forgets the 2⁵.

More Coding Interview Problems questions

Exams that ask this topic