Choose two different positions i < j in values. Their score is values[i] + values[j] - (j - i): the two values minus their distance. Return the highest score among all pairs.
Example 1:
Input: values = [5,1,5]
Output: 8Explanation: Choose indices 0 and 2. Their score is 5 + 5 + 0 - 2 = 8.
Example 2:
Input: values = [1,1]
Output: 1Explanation: The only pair is (0, 1), with score 1 + 1 + 0 - 1 = 1.
Example 3:
Input: values = [2,9,1,2]
Output: 10Explanation: Choose indices 0 and 1. Their score is 2 + 9 + 0 - 1 = 10, the greatest score among the available pairs.
Constraints:
2 <= values.length <= 500001 <= values[i] <= 1000