Maximum Reward Points
Updated
Problem 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^5
- 0 ≤ k ≤ n
- 1 ≤ reward_1[i] ≤ 10^4
- 1 ≤ reward_2[i] ≤ 10^4
Source note: Source images preserve independent Microsoft OA reports for the same task. The newest image confirms the function signature, exact-k assignment rule, constraints, and sample input; the visible source matches the canonical exercise at approximately 99%.
More Microsoft Online Assessment questions
- Maximum Score with Prime JumpsOA · Seen Dec 2026
- Minimum Non-Adjacent Selection CapabilityOA · Seen Dec 2026
- Authentication SystemOA · Seen Nov 2026
- Maximum String OperationsOA · Seen Nov 2026
- Minimum Cost to Process Priority TasksOA · Seen Nov 2026
- Most Visited Sprint MarkerOA · Seen Nov 2026
- Maximum Escape Game ScoreOA · Seen Nov 2026
- Count Subarrays with a Perfect-Square ProductOA · Seen Nov 2026
- Maximum Interactive Team SizeOA · Seen Nov 2026
- Maximize Pipeline Throughput Under a Scaling BudgetOA · Seen Nov 2026
Similar questions at other companies
- Maximum Easy Tasks After RearrangingIBM · OAIBM interview questions
- Maximum Distinct Values After Unit AdjustmentsBirla Pivot · OA
- Maximize Revenue from Decreasing InventoryChubb · OAChubb interview questions
- Minimum Distinct Prefix CostGoldman Sachs · OAGoldman Sachs interview questions
- Maximize Minimum Deployment DifficultyJP Morgan Chase · OAJP Morgan Chase interview questions
- Latest Arrival to Catch a BusAutodesk · OAAutodesk interview questions
- Maximize Center A Package BenefitAmazon · OA
- EV Charging Cost OptimizationTata Consultancy Services · OATata Consultancy Services interview questions
- Maximize Workday EarningsCitadel · OA · PHONE SCREEN · ONSITE INTERVIEWCitadel interview questions
- Minimum Removals to Balance ArraySalesforce · OASalesforce interview questions
Microsoft interview experiences
- Microsoft OA Questions, October 2026: 4 Experiences
- Microsoft Experienced SWE Phone Screen: 1 Experience
- Microsoft Explore and Student SWE: 12 Experiences (Part 6 of 6)
- Microsoft SWE Intern, Early 2025: 41 Experiences (Part 5 of 6)
- Microsoft SWE Intern, Mid 2025: 42 Experiences (Part 4 of 6)
- Microsoft SWE Intern, Late 2025: 47 Experiences (Part 3 of 6)