debug python version, set visited[x][y] to True in the beginning of bfs
This commit is contained in:
parent
d64a535938
commit
492f45f53d
|
|
@ -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:
|
||||
|
|
|
|||
Loading…
Reference in New Issue