Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add solutions to lc problem: No.3033 #2337

Merged
merged 13 commits into from
Feb 11, 2024
Merged
Prev Previous commit
Next Next commit
feat: add solutions to lc problem: No.3033
  • Loading branch information
Nothing-avil authored Feb 11, 2024
commit fb733559e29679a45c20de386a2dfb2f1b76ad7b
18 changes: 18 additions & 0 deletions solution/3000-3099/3033.Modify the Matrix/Solution.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
class Solution {
public int[][] modifiedMatrix(int[][] matrix) {
int r = matrix.length;
int c = matrix[0].length;
for (int i = 0; i < c; i++) {
int maxs = Integer.MIN_VALUE;
for (int j = 0; j < r; j++) {
maxs = Math.max(maxs, matrix[j][i]);
}
for (int j = 0; j < r; j++) {
if (matrix[j][i] == -1) {
matrix[j][i] = maxs;
}
}
}
return matrix;
}
}