Skip to content

Commit 5f3ecea

Browse files
authored
Update 59. 岛屿数量.md
1 parent efc5faf commit 5f3ecea

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

59. 岛屿数量.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,13 @@ class Solution:
2020
if not 0<=i<len(grid) or not 0<=j<len(grid[0]) or grid[i][j] == '0':
2121
return
2222
grid[i][j] = '0'
23+
#情况1
2324
dfs(i+1,j)
25+
#情况2
2426
dfs(i-1,j)
27+
#情况3
2528
dfs(i,j+1)
29+
#情况4
2630
dfs(i,j-1)
2731
2832
for i in range(len(grid)):
@@ -33,4 +37,4 @@ class Solution:
3337
count += 1
3438
#返回要优化的目标
3539
return count
36-
```
40+
```

0 commit comments

Comments
 (0)