8000 add 3033 · githubniraj/Leetcode@0d8b8cb · GitHub
[go: up one dir, main page]

Skip to content

Commit 0d8b8cb

Browse files
add 3033
1 parent ebd553f commit 0d8b8cb

File tree

2 files changed

+29
-1
lines changed

2 files changed

+29
-1
lines changed

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@ _If you like this project, please leave me a star._ ★
88

99
| # | Title | Solutions | Video | Difficulty | Tag
1010
|------|----------------|------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------|----------------------------------|----------------------------------------------------------------------
11-
| 3046 |[Split the Array](https://leetcode.com/problems/split-the-array/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3046.java) | | Easy |
11+
| 3046 |[Split the Array](https://leetcode.com/problems/split-the-array/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3046.java) | | Easy |
1212
| 3042 |[Count Prefix and Suffix Pairs I](https://leetcode.com/problems/count-prefix-and-suffix-pairs-i/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3042.java) | | Easy |
1313
| 3038 |[Maximum Number of Operations With the Same Score I](https://leetcode.com/problems/maximum-number-of-operations-with-the-same-score-i/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3038.java) | | Easy |
14+
| 3033 |[Modify the Matrix](https://leetcode.com/problems/modify-the-matrix/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3033.java) | | Easy |
1415
| 3006 |[Find Beautiful Indices in the Given Array I](https://leetcode.com/problems/find-beautiful-indices-in-the-given-array-i/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3006.java) | | Medium |
1516
| 3005 |[Count Elements With Maximum Frequency](https://leetcode.com/problems/count-elements-with-maximum-frequency/)| [Java](../master/src/main/java/com/fishercoder/solutions/_3005.java) | | Easy |
1617
| 2716 |[Minimize String Length](https://leetcode.com/problems/minimize-string-length/)| [Java](../master/src/main/java/com/fishercoder/solutions/_2716.java) | [:tv:](https://youtu.be/aMJ3T0K8LjI) | Easy |
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
package com.fishercoder.solutions;
2+
3+
public class _3033 {
4+
public static class Solution1 {
5+
public int[][] modifiedMatrix(int[][] matrix) {
6+
if (matrix == null || matrix.length == 0) {
7+
return matrix;
8+
}
9+
int m = matrix.length;
10+
int n = matrix[0].length;
11+
int[][] answer = new int[m][n];
12+
for (int j = 0; j < n; j++) {
13+
int max = -1;
14+
for (int i = 0; i < m; i++) {
15+
max = Math.max(max, matrix[i][j]);
16+
answer[i][j] = matrix[i][j];
17+
}
18+
for (int i = 0; i < m; i++) {
19+
if (matrix[i][j] == -1) {
20+
answer[i][j] = max;
21+
}
22+
}
23+
}
24+
return answer;
25+
}
26+
}
27+
}

0 commit comments

Comments
 (0)
0