Matrix Chain Multiplication Memoization
Medium

Problem Statement

Optimize the recursive MCM solution using top-down memoization to avoid redundant calculations.

Examples

1Example 1
Input:
{ "dims": [ 40, 20, 30, 10, 30 ] }
Output:
26000
2Example 2
Input:
{ "dims": [ 10, 30, 5, 60 ] }
Output:
4500
3Example 3
Input:
{ "dims": [ 10, 20, 30, 40, 30 ] }
Output:
30000
Loading...

Sign in to Run Code and Submit