题目:
题解:
int maximalSquare(char** matrix, int matrixSize, int* matrixColSize){
int dp[301][301]={0};
int wid=0;
if(matrixSize==0&&matrixColSize[0]==0){
return 0;
}
for(int i=0;i<matrixSize;i++){
for(int j=0;j<matrixColSize[0];j++){
if(matrix[i][j]=='1'){
if(i==0||j==0){
dp[i][j]=1;
}
else{
dp[i][j]=fmin(dp[i-1][j],fmin(dp[i][j-1],dp[i-1][j-1]))+1;
}
}
wid=fmax(wid,dp[i][j]);
}
}
return wid*wid;
}