Solved 50th with memoization