prob_14 solve memoization