Infosys Interview Question

Question on the Knapsack Problem