How to maximize rewards with exactly k tasks
Company: MathWorks
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: easy
Interview Round: Technical Screen
Quick Answer: 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.
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.
Input: ([5, 1], [1, 5], 2)
Expected Output: 6
Explanation: All intern 1.
Hints
- Start with all tasks assigned to intern 2, then choose the k largest reward differences.