File tree Expand file tree Collapse file tree 2 files changed +7
-4
lines changed
s3225_maximum_score_from_grid_operations
s3228_maximum_number_of_operations_to_move_ones_to_the_end Expand file tree Collapse file tree 2 files changed +7
-4
lines changed Original file line number Diff line number Diff line change @@ -14,9 +14,10 @@ public long maximumScore(int[][] grid) {
14
14
long [] dp32 = new long [n + 1 ];
15
15
long res = 0 ;
16
16
for (int i = 0 ; i < n ; ++i ) {
17
- long sum = 0 , pre = 0 ;
18
- for (int j = 0 ; j < n ; ++j ) {
19
- sum += grid [j ][i ];
17
+ long sum = 0 ;
18
+ long pre = 0 ;
19
+ for (int [] ints : grid ) {
20
+ sum += ints [i ];
20
21
}
21
22
for (int j = n - 1 ; j >= 0 ; --j ) {
22
23
long s2 = sum ;
Original file line number Diff line number Diff line change 5
5
public class Solution {
6
6
public int maxOperations (String s ) {
7
7
char [] arr = s .toCharArray ();
8
- int result = 0 , ones = 0 , n = arr .length ;
8
+ int result = 0 ;
9
+ int ones = 0 ;
10
+ int n = arr .length ;
9
11
for (int i = 0 ; i < n ; ++i ) {
10
12
ones += arr [i ] - '0' ;
11
13
if (i > 0 && arr [i ] < arr [i - 1 ]) {
You can’t perform that action at this time.
0 commit comments