mirror of
https://github.com/youngyangyang04/leetcode-master.git
synced 2025-07-06 15:09:40 +08:00
debug python version, set visited[x][y] to True in the beginning of bfs
This commit is contained in:
@ -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:
|
||||
|
Reference in New Issue
Block a user