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

Commit 24f780e

Browse files
aQuaaQua
aQua
authored and
aQua
committed
221 wrong answer
1 parent 2ccca9d commit 24f780e

File tree

2 files changed

+13
-3
lines changed

2 files changed

+13
-3
lines changed

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -70,8 +70,8 @@ func maximalSquare(matrix [][]byte) int {
7070
}
7171
}
7272
temp++
73-
if max < temp*temp {
74-
max = temp * temp
73+
if max < temp {
74+
max = temp
7575
}
7676

7777
if a+temp >= m || b+temp >= n {
@@ -87,5 +87,5 @@ func maximalSquare(matrix [][]byte) int {
8787
}
8888
}
8989

90-
return max
90+
return max * max
9191
}

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

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

16+
{
17+
[][]byte{
18+
[]byte("11111111"),
19+
[]byte("11111110"),
20+
[]byte("11111110"),
21+
[]byte("11111000"),
22+
[]byte("01111000"),
23+
},
24+
16,
25+
},
1626
{
1727
[][]byte{
1828
[]byte("0001"),

0 commit comments

Comments
 (0)