Two interns at HackerRank are assigned to complete a total of n tasks. Each task can be completed by either intern. The first intern earns reward_1 points for finishing the ith task, while the second intern earns reward_2 points for the same task.
To maximize the total reward points for both interns, determine the highest possible combined reward points if the first intern is required to complete k tasks, and the second intern completes the remaining tasks.
Note: The k tasks for the first intern can be any of the n tasks.
Consider n = 5, reward_1 = [5, 4, 3, 2, 1], reward_2 = [1, 2, 3, 4, 5] and k = 3.
Intern 1 completes 3 tasks, while intern 2 completes the other 2. To maximize the points, intern 1 takes the first 3 tasks, and intern 2 takes the last 2 tasks. The total reward points are 5 + 4 + 3 (from intern 1) + 4 + 5 (from intern 2) = 21, which is the maximum possible. So, the answer is 21.
IndiaMART • Pending
Amazon • Pending
Amazon • Pending
Code with cisco - CwC 26 • Pending
Code with cisco - CwC 26 • Pending