C++ | O(N) | one pass Solution
dp[i]=maximum sight score till index i\n\nclass Solution {\npublic:\n    int maxScoreSightseeingPair(vector<int>& values) {\n        int n=values.size();\n     
dp[i]=maximum sight score till index i\n```\nclass Solution {\npublic:\n    int maxScoreSightseeingPair(vector<int>& values) {\n        int n=values.size();\n        vector<int> dp(n,0);\n        int ans=0;\n        for(int i=1;i<n;i++)\n        {\n            dp[i]=values[i]+values[i-1]-1;\n            dp[i]=max(dp[i],dp[i-1]-1+values[i]-values[i-1]);\n            ans=max(dp[i],ans);\n        }\n        return ans;\n    }\n};\n```
['Dynamic Programming', 'C']