Java + Two Pointers
\nclass Solution {\n    public int maxScoreSightseeingPair(int[] values) {\n        int i = 0, j = 1, best = 0;\n        \n        while (j < values.length) {\n
```\nclass Solution {\n    public int maxScoreSightseeingPair(int[] values) {\n        int i = 0, j = 1, best = 0;\n        \n        while (j < values.length) {\n            best = Math.max(best, values[i] + values[j] + i - j);\n            \n            if (values[i] - values[j] < j - i) {\n                i = j;\n            } \n            \n            j++;\n        }\n        \n        return best;\n    }\n}\n```
['Two Pointers', 'Java']