Skip to content

Commit e55b769

Browse files
authored
Update MaxRectangularSubmatrixOf1s.java
1 parent 563a8eb commit e55b769

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

DynamicProgramming/MaxRectangularSubmatrixOf1s.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,16 @@ public int maxRectSubmatrix(int A[][]){ //Time Complexity - O(n*m)
2020
int maxArea = 0;
2121

2222
//temporary array used for computation with maxHistogram
23-
//we keep adding column values as we move down the rows but reset for if value in A = 0
23+
//we keep adding column values as we move down the rows but reset if value in A = 0
2424
int temp[] = new int[m];
2525

2626
for(int i=0;i<n;i++){
27+
2728
for(int j=0;j<m;j++){
2829
if(A[i][j] == 0) temp[j] = 0;
2930
else temp[j]+=A[i][j];
3031
}
32+
3133
maxArea = Math.max(maxHistogram(temp), maxArea);
3234
}
3335

0 commit comments

Comments
 (0)