Matrix Chain Multiplication
Let's solve the Matrix Chain Multiplication problem using Dynamic Programming.
Statement
You are given a chain of matrices to be multiplied. You have to find the least number of primitive multiplications needed to evaluate the result.
Note: Given two matrices and of dimensions and , the resulting matrix we get is , whose dimensions are . Further, when multiplying these two matrices, the number of primitive multiplications is .
Level up your interview prep. Join Educative to access 80+ hands-on prep courses.