Skip to content

Commit 04194fb

Browse files
committed
Runtime: 5 ms (Top 98.27%) | Memory: 53.6 MB (Top 98.31%)
1 parent 9ce16a2 commit 04194fb

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

scripts/algorithms/M/Maximal Square/Maximal Square.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
// Runtime: 5 ms (Top 98.27%) | Memory: 53.6 MB (Top 98.31%)
12
class Solution {
23
public int maximalSquare(char[][] matrix) {
34
int m = matrix.length;
45
int n = matrix[0].length;
56
int[][] dp = new int[m][n];
6-
7+
78
int max = 0;
8-
9+
910
for (int i = 0; i < m; i++) {
1011
dp[i][0] = matrix[i][0] - 48;
1112
if (matrix[i][0] == '1') max = 1;
@@ -25,7 +26,7 @@ public int maximalSquare(char[][] matrix) {
2526
}
2627
}
2728
}
28-
29+
2930
return max * max;
3031
}
31-
}
32+
}

0 commit comments

Comments
 (0)