We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 563a8eb commit e55b769Copy full SHA for e55b769
DynamicProgramming/MaxRectangularSubmatrixOf1s.java
@@ -20,14 +20,16 @@ public int maxRectSubmatrix(int A[][]){ //Time Complexity - O(n*m)
20
int maxArea = 0;
21
22
//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
+ //we keep adding column values as we move down the rows but reset if value in A = 0
24
int temp[] = new int[m];
25
26
for(int i=0;i<n;i++){
27
+
28
for(int j=0;j<m;j++){
29
if(A[i][j] == 0) temp[j] = 0;
30
else temp[j]+=A[i][j];
31
}
32
33
maxArea = Math.max(maxHistogram(temp), maxArea);
34
35
0 commit comments