Dynamic Programming for Knapsack problem