Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 492f45f

Browse files
committed
debug python version, set visited[x][y] to True in the beginning of bfs
1 parent d64a535 commit 492f45f

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

problems/kamacoder/0099.岛屿的数量广搜.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,7 @@ directions = [[0, 1], [1, 0], [0, -1], [-1, 0]]
254254
def bfs(grid, visited, x, y):
255255
que = deque([])
256256
que.append([x,y])
257+
visited[x][y] = True
257258
while que:
258259
cur_x, cur_y = que.popleft()
259260
for i, j in directions:

0 commit comments

Comments
 (0)