AlgoMaster Logo

01 Matrix

grid=[[0,0,0],[0,1,0],[0,0,0]]
0 / 50
max dist0unvisited100000000queuemulti-source BFS: distance from every cell to the nearest 0
algomaster.io
Step:Multi-source BFS: find each cell's distance to the nearest 0