How to maximize rewards with exactly k tasks
Company: MathWorks
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Technical Screen
Overview: This Coding & Algorithms question evaluates a candidate's ability to perform combinatorial optimization and benefit-based assignment reasoning on arrays, testing algorithm design, complexity-aware implementation, and quantitative decision-making in constrained assignment problems.
Read the full MathWorks Software Engineer interview experience this question came from
Examples
Input: ([10, 20, 30], [5, 50, 5], 2)
Expected Output: 90
Explanation: Choose largest deltas.
Input: ([1, 2], [10, 20], 0)
Expected Output: 30
Explanation: All intern 2.
Hints
- Start with all tasks assigned to intern 2, then choose the k largest reward differences.