C++ Easy Solution | DP |  TC O(N) | SC O(1)
( val[i]+i ) + (val[j]-j)\n\nclass Solution {\npublic:\n    int maxScoreSightseeingPair(vector<int>& a) {\n        int maxi=a[0]+0;\n        int ans=-1;\n      
( val[i]+i ) + (val[j]-j)\n```\nclass Solution {\npublic:\n    int maxScoreSightseeingPair(vector<int>& a) {\n        int maxi=a[0]+0;\n        int ans=-1;\n        int n=a.size();\n        for(int i=1;i<n;i++){\n            ans=max(ans,maxi+a[i]-i);\n            maxi=max(maxi,a[i]+i);\n        }\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'C', 'C++']