File tree Expand file tree Collapse file tree 1 file changed +0
-5
lines changed
src/main/java/g1901_2000/s1937_maximum_number_of_points_with_cost Expand file tree Collapse file tree 1 file changed +0
-5
lines changed Original file line number Diff line number Diff line change 55public 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 );
You can’t perform that action at this time.
0 commit comments