Java || Array + DP || 1ms || beats 100% || T.C - O(N) S.C - O(1)
\n\n\t// O(n) O(1)\n\tpublic int maxScoreSightseeingPair(int[] values) {\n\n\t\tint ans = Integer.MIN_VALUE, len = values.length, max = values[0];\n\n\t\tfor (i
\n\n\t// O(n) O(1)\n\tpublic int maxScoreSightseeingPair(int[] values) {\n\n\t\tint ans = Integer.MIN_VALUE, len = values.length, max = values[0];\n\n\t\tfor (int j = 1; j < len; j++) {\n\t\t\tint curr = values[j] - j;\n\t\t\tif (max + curr > ans)\n\t\t\t\tans = max + curr;\n\t\t\tif (values[j] + j > max)\n\t\t\t\tmax = values[j] + j;\n\t\t}\n\n\t\treturn ans;\n\t}
[]