C++ || well commented
\nclass Solution {\npublic:\n    int maxScoreSightseeingPair(vector<int>& values) {\n        \n        // main condition is that (i < j) \n        \n        int
```\nclass Solution {\npublic:\n    int maxScoreSightseeingPair(vector<int>& values) {\n        \n        // main condition is that (i < j) \n        \n        int n = values.size();\n        \n        // from the formula (values[i] + i) + (values[j] - j)\n        int base = values[0] + 0;\n        \n        int ans = INT_MIN;\n        \n        for (int i = 1; i < n; i++)\n        {\n            // now if we find any value of (value[i] + i) greater than base\n            \n            ans = max (ans, base + values[i] - i);\n            base = max(base, values[i] + i);\n        }\n        return ans;    \n    }\n};\n```
[]