Problem 55355. Chain multiplication - 05
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
Solution Comments
Show commentsProblem Recent Solvers2
Suggested Problems
-
Sort a list of complex numbers based on far they are from the origin.
5554 Solvers
-
Given an unsigned integer x, find the largest y by rearranging the bits in x
1697 Solvers
-
Find the stride of the longest skip sequence
148 Solvers
-
Back to basics 21 - Matrix replicating
1472 Solvers
-
Make an awesome ramp for a tiny motorcycle stuntman
610 Solvers
More from this Author165
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!