added fastMaxVal api which uses memoization for knapsack