Optimize the recursive MCM solution using top-down memoization to avoid redundant calculations.
{ "dims": [ 40, 20, 30, 10, 30 ] }
26000
{ "dims": [ 10, 30, 5, 60 ] }
4500
{ "dims": [ 10, 20, 30, 40, 30 ] }
30000
Sign in to Run Code and Submit