Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
01 Matrix
Bookmark
Input
Example 1
Example 2
Corner zeros
Single zero
Custom
grid
=
[[0,0,0],[0,1,0],[0,0,0]]
max dist
0
unvisited
1
0
0
0
0
0
0
0
0
queue
multi-source BFS: distance from every cell to the nearest 0
algo
master
.
io
Step:
Multi-source BFS: find each cell's distance to the nearest 0
0 / 50
Input
Example 1
Example 2
Corner zeros
Single zero
Custom
grid
=
[[0,0,0],[0,1,0],[0,0,0]]
0 / 50
max dist
0
unvisited
1
0
0
0
0
0
0
0
0
queue
multi-source BFS: distance from every cell to the nearest 0
algo
master
.
io
Step:
Multi-source BFS: find each cell's distance to the nearest 0