S&P Global interview question

Knapsack problem