Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 21bbebf

Browse files
authored
Create Code Testcase Test Result Test Result 1014. Best Sightseeing Pair
1 parent 473e9b7 commit 21bbebf

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
class Solution {
2+
public int maxScoreSightseeingPair(int[] values) {
3+
int result =0;
4+
int max = values[0];
5+
for(int i=1;i<values.length;i++){
6+
result = Math.max(result, max+values[i] - i);
7+
max = Math.max(max, values[i] + i);
8+
}
9+
return result;
10+
}
11+
}

0 commit comments

Comments
 (0)