Maximum Reward Allocation

Asked at MathWorks · Coding Questions · Difficulty: Medium · Last asked Jul 15, 2026

There are two interns and n tasks. For the i-th task, if finished by intern 1, it yields reward1[i]; if finished by intern 2, it yields reward2[i]. Intern 1 must complete exactly k tasks, while intern 2 will do the remaining n-k tasks. How would you allocate the tasks to maximize the total reward for both and return the maximum value?

Loading the problem…