Skip to content

Commit 40bc9f2

Browse files
authored
Update Solution.java
1 parent eb62317 commit 40bc9f2

File tree

1 file changed

+0
-5
lines changed
  • src/main/java/g1901_2000/s1937_maximum_number_of_points_with_cost

1 file changed

+0
-5
lines changed

src/main/java/g1901_2000/s1937_maximum_number_of_points_with_cost/Solution.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,26 +5,21 @@
55
public class Solution {
66
public long maxPoints(int[][] points) {
77
int m = points[0].length;
8-
98
long[] pre = new long[m];
10-
119
for (int[] point : points) {
1210
long[] current = new long[m];
13-
1411
long max = Long.MIN_VALUE;
1512
for (int j = 0; j < m; j++) {
1613
max = Math.max(max, pre[j] + j);
1714
current[j] = Math.max(current[j], point[j] - j + max);
1815
}
19-
2016
max = Long.MIN_VALUE;
2117
for (int j = m - 1; j >= 0; j--) {
2218
max = Math.max(max, pre[j] - j);
2319
current[j] = Math.max(current[j], point[j] + j + max);
2420
}
2521
pre = current;
2622
}
27-
2823
long max = Long.MIN_VALUE;
2924
for (long val : pre) {
3025
max = Math.max(max, val);

0 commit comments

Comments
 (0)