Solve knapsack problem using bottom up optimization