Data Structures & AlgorithmsHardICPC regional · DP round

Problem: A product of 11 matrices A1 * A2 * ... * A11 is evaluated by choosing a full parenthesisation. How many different parenthesisations are possible?

  1. A. 4862
  2. B. 58786
  3. C. 16796
  4. D. 16384

Correct answer: C. 16796

A product of n matrices has Catalan(n - 1) parenthesisations, so 11 matrices give Catalan(10) = 16796. Using Catalan(9) = 4862 is the off-by-one trap.

More Coding Interview Problems questions

Exams that ask this topic