knapsack, memoization