class Solution {
public:
/**
* 最大正方形
* @param matrix char字符型vector<vector<>>
* @return int整型
*/
int solve(vector<vector<char> >& matrix) {
int column = matrix.size(), line = matrix[0].size();
if (column == 0) {
return 0;
}
int bianchang = 0;
vector<vector<int>>dp(column, vector<int>(line, 0));
for (int i = 0; i < column; i++) {
for (int j = 0; j < line; j++) {
if (i == 0 || j == 0 ) {
dp[i][j] = matrix[i][j] - '0';
} else if (matrix[i][j] == '0') {
dp[i][j] = 0;
} else {
int minNum = min(dp[i-1][j], dp[i][j-1]);
dp[i][j] = min(dp[i-1][j-1], minNum) + 1;
cout << bianchang << endl;
}
bianchang = max(bianchang, dp[i][j]);
}
}
return bianchang * bianchang;
// write code here
}
};