Learn
Practice
Newsletter
Resources
Animations
New
F
Toggle theme
0
F
0
Toggle menu
← Back to All Animations
Rotting Oranges
Bookmark
Input
Example 1
Example 2 (impossible)
Single row
Multi-source BFS
Custom
grid
=
[[2,1,1],[1,1,0],[0,1,1]]
minute
0
fresh
6
2
1
1
1
1
1
1
queue
multi-source BFS: rot spreads to neighbors each minute
algo
master
.
io
Step:
Spread rot outward from every initially rotten orange
0 / 45
Input
Example 1
Example 2 (impossible)
Single row
Multi-source BFS
Custom
grid
=
[[2,1,1],[1,1,0],[0,1,1]]
0 / 45
minute
0
fresh
6
2
1
1
1
1
1
1
queue
multi-source BFS: rot spreads to neighbors each minute
algo
master
.
io
Step:
Spread rot outward from every initially rotten orange