Memoization problem set