Solved 1a. Check the complexity of the memoization.