Use memoization for dynamic programming