leetcode1030】的更多相关文章

We are given a matrix with R rows and C columns has cells with integer coordinates (r, c), where 0 <= r < R and 0 <= c < C. Additionally, we are given a cell in that matrix with coordinates (r0, c0). Return the coordinates of all cells in the…
class Solution(object): def __init__(self): self.List = list() def bfs(self,R,C,S,V): T = list() while len(S) >0: node = S.pop(0) if node[0]-1>=0 and V[node[0]-1][node[1]] == 0: V[node[0]-1][node[1]] = 1 T.append([node[0]-1,node[1]]) self.List.appen…