Maximize the Minimum Game Score - Problem
You are given an array points of size n and an integer m. There is another array gameScore of size n, where gameScore[i] represents the score achieved at the i-th game. Initially, gameScore[i] == 0 for all i.
You start at index -1, which is outside the array (before the first position at index 0). You can make at most m moves. In each move, you can either:
- Increase the index by 1 and add
points[i]togameScore[i] - Decrease the index by 1 and add
points[i]togameScore[i]
Note that the index must always remain within the bounds of the array after the first move.
Return the maximum possible minimum value in gameScore after at most m moves.
Input & Output
Example 1 — Basic Expansion
$
Input:
points = [3,1,4,2], m = 4
›
Output:
2
💡 Note:
Start at position 0, then visit positions 1 and 2. With 4 moves, we can achieve scores [3,2,4,0], giving minimum = 2.
Example 2 — Limited Moves
$
Input:
points = [1,5,2,3], m = 3
›
Output:
1
💡 Note:
With only 3 moves, we can visit positions 0,1,2 getting scores [1,5,2,0]. Minimum among visited is 1.
Example 3 — Single Element
$
Input:
points = [10], m = 2
›
Output:
20
💡 Note:
Only one position exists. Use both moves on position 0: score[0] = 20, minimum = 20.
Constraints
- 1 ≤ points.length ≤ 105
- 1 ≤ points[i] ≤ 104
- 1 ≤ m ≤ 2 × 105
Visualization
Tap to expand
Understanding the Visualization
1
Input
Points array [3,1,4,2] with m=4 moves
2
Process
Start at index -1, make strategic moves to maximize minimum score
3
Output
Maximum possible minimum score = 2
Key Takeaway
🎯 Key Insight: Binary search the answer space and verify feasibility with greedy expansion
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code