AlgoMaster Logo

Best Sightseeing Pair

values=[8, 1, 5, 2, 6]
0 / 11
algomaster.io
Step:Score = values[i] + values[j] + i - j. Try every pair i < j and keep the maximum.