#3449

Maximize the Minimum Game Score

international master · 2085 · lc hard +32 · premium · 26.1% accepted · 51 likes · top 4%

Description

You have an array points of length n and an integer m. Track scores in array gameScore (initially all zeros) of the same length.

Beginning at index -1 (before position 0), make at most m moves. Each move either:

- Advances to the next index and adds points[i] to gameScore[i].

- Goes back to the previous index and adds points[i] to gameScore[i].

After the first move, the index must stay within valid bounds.

Return the maximum achievable minimum value across all entries in gameScore.

Code

1
2
3