commit the iterative and memoization version
thought I had done this earlier!