C3 AI interview question

Dynamic programming challenge similar to knapsack problem