Data Structures & AlgorithmsVery hardGATE CS

Matrices A1…A7 have dimensions 5×10, 10×3, 3×12, 12×5, 5×50, 50×6, 6×8. What is the minimum number of scalar multiplications needed to compute the product A1A2…A7?

  1. A. 2184
  2. B. 3620
  3. C. 2484
  4. D. 2034

Correct answer: A. 2184

The matrix-chain DP gives 2184. Multiplying strictly left to right costs 3620.

More Coding Interview Problems questions

Exams that ask this topic