Maximize minimum value after k decrements
Company: MathWorks
Role: Software Engineer
Category: Coding & Algorithms
Difficulty: medium
Interview Round: Take-home Project
Quick Answer: This question evaluates array-based optimization skills, resource-allocation reasoning under a fixed decrement budget, and algorithmic complexity analysis for maximizing a minimum value after constrained operations.
Constraints
- Inputs are Python literals matching the function signature.
- Return a deterministic exact-match value.
Examples
Input: ([5,1,4], 3)
Expected Output: 1
Explanation: All decrements can be spent above the current minimum.
Input: ([1,1], 1)
Expected Output: 0
Explanation: Once all values are at the minimum, any decrement lowers the minimum.
Input: ([3,3,3], 6)
Expected Output: 1
Explanation: Two full rounds lower the minimum by two.
Hints
- First spend decrements on values above the current minimum.
- Any remaining decrements must be spread across all minimum values.