Problem 14 first pass w/ memoization