The next step is to take the recursive solution for
, and use memoization.
There should be a cache that saves the values of subproblems, and saving the cache value should be added to at the bottom of the function. At the top of the function, the value from the cache should be returned if it has been set.
The solution should be able to handle