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) {
1414 long [] dp32 = new long [n + 1 ];
1515 long res = 0 ;
1616 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 ];
2021 }
2122 for (int j = n - 1 ; j >= 0 ; --j ) {
2223 long s2 = sum ;
Original file line number Diff line number Diff line change 55public class Solution {
66 public int maxOperations (String s ) {
77 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 ;
911 for (int i = 0 ; i < n ; ++i ) {
1012 ones += arr [i ] - '0' ;
1113 if (i > 0 && arr [i ] < arr [i - 1 ]) {
You can’t perform that action at this time.
0 commit comments