Skip to content

Commit f0b7f00

Browse files
Added solution
1 parent 7a0afee commit f0b7f00

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

maximal_square.cpp

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,21 @@ class Solution {
4040
return globalMax * globalMax;
4141
//return 0;
4242
}
43-
};
43+
};
44+
45+
46+
/*
47+
if(matrix.size()==0 || matrix[0].size()==0)return 0;
48+
int maxi=0,n=matrix.size(),m=matrix[0].size();
49+
vector<vector<int> > dp(n,vector<int>(m,0));
50+
for(int i=0;i<n;i++){
51+
for(int j=0;j<m;j++){
52+
if(i==0 || j==0)dp[i][j]=matrix[i][j]-'0';
53+
else{
54+
if(matrix[i][j]=='1')dp[i][j]=1+min(dp[i-1][j-1],min(dp[i-1][j],dp[i][j-1]));
55+
}
56+
maxi=max(maxi,dp[i][j]);
57+
}
58+
}
59+
return maxi*maxi;
60+
*/

0 commit comments

Comments
 (0)