Implement the multi-source BFS algorithm. Return the minimum number of minutes that must elapse until no cell has a fresh orange. If impossible, return -1.
{
"grid": [
[
2,
1,
1
],
[
1,
1,
0
],
[
0,
1,
1
]
]
}4{
"grid": [
[
2,
1,
1
],
[
0,
1,
1
],
[
1,
0,
1
]
]
}-1{
"grid": [
[
0,
2
]
]
}0Sign in to Run Code and Submit