mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-11 04:54:51 +08:00
Update 0695.岛屿的最大面积.md
This commit is contained in:
@ -535,11 +535,7 @@ func maxAreaOfIsland(grid [][]int) int {
|
|||||||
for i, rows := range grid {
|
for i, rows := range grid {
|
||||||
for j, v := range rows {
|
for j, v := range rows {
|
||||||
if v == 1 && !visited[i][j] {
|
if v == 1 && !visited[i][j] {
|
||||||
// 第一种写法,重制 count,必定有 1 个
|
|
||||||
// count = 1
|
|
||||||
// 第二种写法以及 bfs
|
|
||||||
count = 0
|
count = 0
|
||||||
// dfs(grid, visited, i, j)
|
|
||||||
bfs(grid, visited, i, j)
|
bfs(grid, visited, i, j)
|
||||||
res = max(res, count)
|
res = max(res, count)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user