Skip to content

Commit e673eff

Browse files
committed
Runtime: 16 ms (Top 80.93%) | Memory: 104.9 MB (Top 83.74%)
1 parent 3c284a9 commit e673eff

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
1+
// Runtime: 16 ms (Top 80.93%) | Memory: 104.9 MB (Top 83.74%)
12
class Solution {
23
public int findMaxValueOfEquation(int[][] points, int k) {
34
int ans=Integer.MIN_VALUE;
4-
int i=0;
5+
int i=0;
56
int f=1;
67
while(i < points.length) {
78
if(f<i+1)
89
f=i+1;
910
for (int j = f; j <= points.length-1; j++) {
1011
if(points[j][0]>(points[i][0]+k))
11-
break;
12+
break;
1213
if((points[i][1]+points[j][1]+points[j][0]-points[i][0])>ans){
1314
ans=points[i][1]+points[j][1]+points[j][0]-points[i][0];
1415
f=j-1;
@@ -18,4 +19,4 @@ public int findMaxValueOfEquation(int[][] points, int k) {
1819
}
1920
return ans;
2021
}
21-
}
22+
}

0 commit comments

Comments
 (0)