Skip to content

Commit 5929a5b

Browse files
committed
Time: 8 ms (29.87%), Space: 55 MB (62.44%) - LeetHub
1 parent b40c71e commit 5929a5b

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

1975-maximum-matrix-sum/1975-maximum-matrix-sum.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,7 @@ public long maxMatrixSum(int[][] matrix) {
1111
small = Math.min(Math.abs(matrix[i][j]),small);
1212
sum+=Math.abs(matrix[i][j]);
1313
}
14-
}
15-
if(cnt%2==0){
16-
return sum;
17-
}else{
18-
sum-=2*small;
19-
return sum;
20-
}
14+
}
15+
return (cnt%2==0)?sum : sum-2*small;
2116
}
2217
}

0 commit comments

Comments
 (0)