Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Commit 2d30273

Browse files
aQuaaQua
aQua
authored and
aQua
committed
221 wrong answer
1 parent a17586a commit 2d30273

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

Algorithms/0221.maximal-square/maximal-square.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ func maximalSquare(matrix [][]byte) int {
1818
dp[i][0] = 1
1919
}
2020
}
21-
for j := 0; j < n; j++ {
21+
for j := 1; j < n; j++ {
2222
if matrix[0][j] == '1' {
2323
dp[0][j] = 1
2424
}
2525
}
2626

27-
maxEdge := 0
27+
maxEdge := dp[0][0]
2828

2929
for i := 1; i < m; i++ {
3030
for j := 1; j < n; j++ {

Algorithms/0221.maximal-square/maximal-square_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,13 @@ var tcs = []struct {
1313
ans int
1414
}{
1515

16+
{
17+
[][]byte{
18+
[]byte("01"),
19+
},
20+
1,
21+
},
22+
1623
{
1724
[][]byte{
1825
[]byte("1"),

0 commit comments

Comments
 (0)