Skip to content

Commit bd3640b

Browse files
author
applewjg
committed
fix bug
1 parent 91a1037 commit bd3640b

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

MaximalRectangle.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,18 @@ class Solution {
8585
return res;
8686
}
8787

88-
int maximalRectangle_2(vector<vector<char> > &matrix) {
88+
int maximalRectangle_3(vector<vector<char> > &matrix) {
8989
if (matrix.empty()) return 0;
9090
int m = matrix.size();
9191
int n = matrix[0].size();
92-
std::vector<int> H(n);
93-
std::vector<int> L(n);
94-
std::vector<int> R(n);
92+
std::vector<int> H(n, 0);
93+
std::vector<int> L(n, 0);
94+
std::vector<int> R(n, n);
9595
int res = 0;
9696
for (int i = 0; i < m; ++i) {
9797
int left = 0, right = n;
9898
for (int j = 0; j < n; ++j) {
99-
if (matrix[i][j] == 1) {
99+
if (matrix[i][j] == '1') {
100100
++H[j];
101101
L[j] = max(left, L[j]);
102102
} else {

0 commit comments

Comments
 (0)