0-1 knapsack problem: dynamic programming solution.