Maximize the Minimum Game Score
hard · premium · 26.1% accepted · 51 likes · top 4%
array · binary search · greedy
Description
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 ith 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] to gameScore[i].
- Decrease the index by 1 and add points[i] to gameScore[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.
Solution