Added problem 14 with memoization