Problem · Array
Maximum Reward Points
Learn this problemProblem statement
Two interns are assigned to complete a total of n tasks. Each task must be completed by exactly one of them. For task i, the first intern earns reward_1[i] points and the second intern earns reward_2[i] points.
The first intern must complete exactly k tasks, which may be any k of the n tasks. The second intern completes the remaining tasks. Return the maximum possible combined reward points.
Function
getMaximumRewardPoints(k: int, reward_1: int[], reward_2: int[]) → intExamples
Example 1
k = 3reward_1 = [5, 4, 3, 2, 1]reward_2 = [1, 2, 3, 4, 5]return = 21The first intern completes the first three tasks and earns 5 + 4 + 3 points. The second intern completes the remaining two tasks and earns 4 + 5 points. Their combined reward is 5 + 4 + 3 + 4 + 5 = 21, which is the maximum possible.
Constraints
1 ≤ n ≤ 10^50 ≤ k ≤ n1 ≤ reward_1[i] ≤ 10^4
More Microsoft problems
- Maximum Pipeline ThroughputOA · Seen Jul 2026
- Maximum Strong Team SubarrayOA · Seen Jul 2026
- Minimum Cost K-Capable ModelsOA · Seen Jul 2026
- Alphabetically Smallest PalindromeOA · Seen Jul 2026
- Maximum Strength of Every NeuronOA · Seen Jul 2026
- Neural Network Subnetwork StrengthOA · Seen Jul 2026
- XOR MultiplicationOA · Seen Jul 2026
- Escape Game - Maximize ScoreOA · Seen Jul 2026