Following up on the problem in 55305, you found the optimal way of multiplying a chain of matrices.
In problem 55315, you had to calculate the number of multiplications required based on the positions of parenthesis.
This problem is a combination of the previous two. You have to place the parenthesis in the proper places so that minimum number of multiplications are required.
For instance, array= [1,2,3,2].
So there are three matrices A, B, and C.
you can multiply in two ways - A(BC) or (AB)C.
A(BC) - requires total 16 multiplications, while (AB)C requires total 12 multiplications. So the later one is the answer.

Solution Stats

3 Solutions

3 Solvers

Last Solution submitted on Jul 31, 2024

Last 200 Solutions

Solution Comments

Show comments
Loading...