C++ Simple O(n) time
\tint maxScoreSightseeingPair(vector& values) {\n\t\t\tint n = values.size();\n\t\t\tint num = values[0];\n\t\t\tint ans = INT_MIN;\n\t\t\tfor (int i=1; i<n; i+
\tint maxScoreSightseeingPair(vector<int>& values) {\n\t\t\tint n = values.size();\n\t\t\tint num = values[0];\n\t\t\tint ans = INT_MIN;\n\t\t\tfor (int i=1; i<n; i++) {\n\t\t\t\tans = max(ans, num+values[i]-i);\n\t\t\t\tnum = max(values[i]+i, num);\n\t\t\t}\n\t\t\treturn ans;\n\t\t}
[]