90 % faster C++ solution with explanation.
As i<j so values[i] + values[j] + i - j is (values[i]+i) +( values[j]- j ) i.e for any j we just need the max of (values[i]+i)\nAt starting values[i]+i =values[
As i<j so values[i] + values[j] + i - j is (values[i]+i) +( values[j]- j ) i.e for any j we just need the max of (values[i]+i)\nAt starting values[i]+i =values[0] then we calculate our ans for that index and keep the max of all previousally calculated ans ,simultaneousally we update our best \n```\nclass Solution {\npublic:\n    int maxScoreSightseeingPair(vector<int>& values) {\n        int best=values[0];\n        int ans=0;\n        for(int j=1;j<values.size();j++)\n        {\n            ans=max(ans,best+values[j]-j);\n            best=max(best,values[j]+j);\n        }\n        return ans;\n    }\n};\n```
[]