added memoized bottom-up, memoized top down solutions