From 492f45f53d6e46bfed1d91cc91fe0a3d91964ead Mon Sep 17 00:00:00 2001 From: HONGYAN ZHAO Date: Thu, 24 Oct 2024 21:08:52 -0500 Subject: [PATCH] debug python version, set visited[x][y] to True in the beginning of bfs --- problems/kamacoder/0099.岛屿的数量广搜.md | 1 + 1 file changed, 1 insertion(+) diff --git a/problems/kamacoder/0099.岛屿的数量广搜.md b/problems/kamacoder/0099.岛屿的数量广搜.md index 9d31c922..522e19c3 100644 --- a/problems/kamacoder/0099.岛屿的数量广搜.md +++ b/problems/kamacoder/0099.岛屿的数量广搜.md @@ -254,6 +254,7 @@ directions = [[0, 1], [1, 0], [0, -1], [-1, 0]] def bfs(grid, visited, x, y): que = deque([]) que.append([x,y]) + visited[x][y] = True while que: cur_x, cur_y = que.popleft() for i, j in directions: