Solve an optimization problem by caching subproblem solutions (memoization) rather than recomputing them.