C++ simple solution
\nclass Solution {\npublic:\n    int maxScoreSightseeingPair(vector<int>& values) {\n        int prefix = values[0], ans = 0, n = values.size(), i;\n        for
```\nclass Solution {\npublic:\n    int maxScoreSightseeingPair(vector<int>& values) {\n        int prefix = values[0], ans = 0, n = values.size(), i;\n        for (i = 1; i < n; i++) {\n            ans = max(ans, prefix + values[i] - i);\n            prefix = max(prefix, values[i] + i);\n        }\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'C']