Reported September 2026
Microsoftgreedy

Maximum Reward Points

Reported by candidates from Microsoft's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Microsoft OA. Under 2s to a working solution.
Founder's read

The mistake that sinks a first attempt at this Microsoft OA question, reported in September 2026, is sorting by reward_1 alone and grabbing the top k. It looks right and fails on the second intern's rewards. This is Maximum Reward Points, a greedy problem with a sorting step. Two interns, n tasks, the first must take exactly k. You can solve it in a few lines once you see the reframe. If you blank on the reframe during the live OA, StealthCoder runs invisibly on your desktop as a safety net and gives you the solution while you keep control of the screen.

The problem

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[]) → int

Examples
Example 1
k = 3
reward_1 = [5, 4, 3, 2, 1]
reward_2 = [1, 2, 3, 4, 5]
return = 21
The 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^5
0 ≤ k ≤ n
1 ≤ reward_1[i] ≤ 10^4
1 ≤ reward_2[i] ≤ 10^4

Reported by candidates. Source: FastPrep

Pattern and pitfall

Start by giving every task to the second intern. Your baseline is sum(reward_2). Now pick k tasks to hand to the first intern. Each swap changes the total by reward_1[i] - reward_2[i]. So compute that difference per task, sort descending, and add the top k differences to the baseline. That's the whole trick. The pitfall is sorting by reward_1 alone, or by reward_2 alone. Both ignore what you lose by moving the task. Another trap is adding only positive differences. Don't. The first intern must take exactly k tasks, so you take the top k even if some differences are negative. Check k = 0 and k = n, which should fall out naturally. Complexity is O(n log n) for the sort, fine for n up to 10^5. Use a 64-bit-safe sum if your language needs it, though 10^5 times 10^4 fits in a 32-bit int only barely at 10^9. If the reframe slips away mid-assessment, StealthCoder is the hedge that surfaces it.

If you see this problem in your OA tomorrow, the play is to recognize the pattern in 30 seconds. StealthCoder buys you that recognition.

If this hits your live OA

You can drill Maximum Reward Points cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken.

Get StealthCoder

Related leaked OAs

⏵ The honest play

You've seen the question. Make sure you actually pass Microsoft's OA.

Microsoft reuses patterns across OAs. Built by an Amazon engineer who passed his OA cold and still thinks the filter is broken. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Maximum Reward Points FAQ

What's the trick in Maximum Reward Points?+

Give all tasks to the second intern first, then compute reward_1[i] - reward_2[i] for each task. Sort those differences descending and add the top k to the baseline sum of reward_2. It's a greedy exchange argument, and it handles every case cleanly.

Why doesn't sorting by reward_1 work?+

Because each task also has a reward_2 value you give up when you reassign it. A task with reward_1 = 10 and reward_2 = 10 gains nothing from moving. Only the difference tells you which k tasks benefit most from going to the first intern.

Do I only add positive differences?+

No. The first intern must complete exactly k tasks. If fewer than k differences are positive, you still take the top k, including negative ones. Skipping them breaks the exactly-k constraint and gives a wrong answer on cases like k = n.

What complexity does this Microsoft OA need?+

With n up to 10^5, O(n log n) from sorting the differences is fine. You could use a heap or quickselect for the top k, but sorting is simpler and less error-prone. Anything quadratic will time out, so avoid trying all combinations or a 2D DP.

How do I prepare for this in 48 hours?+

Practice the exchange-argument pattern: start from a baseline, then pick the best k adjustments. Write this one from scratch twice and test k = 0, k = n, and the sample answer of 21. Similar problems with a forced count of picks use the same reframe.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Microsoft.

OA at Microsoft?
Invisible during screen share
Get it