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]]
0
0
0
0
-1
0
0
0
0
queue
Zero
Unvisited
Computed
algo
master
.
io
Step:
Start: Find nearest distance to 0 for each cell using multi-source BFS
0 / 50
Input
Example 1
Example 2
Corner zeros
Single zero
Custom
grid
=
[[0,0,0],[0,1,0],[0,0,0]]
0 / 50
0
0
0
0
-1
0
0
0
0
queue
Zero
Unvisited
Computed
algo
master
.
io
Step:
Start: Find nearest distance to 0 for each cell using multi-source BFS