[Java] One pass | Easy to understand solution
Divide the score into 2 parts - A[i]+i and A[j]-j. For each j value, we will check if the sum of maximum  A[i]+i value found so far and current A[j]-j is greate
Divide the score into 2 parts - ```A[i]+i``` and ```A[j]-j```. For each ```j``` value, we will check if the sum of maximum  ```A[i]+i``` value found so far and current ```A[j]-j``` is greater than the ```res```.\n```\nclass Solution {\n    public int maxScoreSightseeingPair(int[] A) {\n\t\t//Intitialize previously seen value of A[i] + i\n        int prev_max = A[0]+0;\n\t\t//Initialize the value of first pair\n        int res = A[0] + A[1] - 1;\n        for(int j = 1; j < A.length; j++){\n\t\t\t//update res if a higher value of prev_max+A[j]-j is found\n            res = Math.max(prev_max + A[j] - j, res);\n\t\t\t//Update prev_max\n            prev_max = Math.max(A[j] + j, prev_max);\n        }\n        return res;\n    }\n}\n\n```
['Java']