[Javascript] O(n) time, O(1) space, kadane variation
\n var maxScoreSightseeingPair = function(values) {\n\n    let prevMax = values[0], max = 0;\n\n    for(let i = 1; i < values.length; i++) {\n\n        prevMax-
```\n var maxScoreSightseeingPair = function(values) {\n\n    let prevMax = values[0], max = 0;\n\n    for(let i = 1; i < values.length; i++) {\n\n        prevMax--;\n        max = Math.max(max, prevMax + values[i]);\n        prevMax = Math.max(prevMax, values[i]);\n    }\n    \n    return max;\n};\n```
['JavaScript']