Rotting Oranges
You are given a 2D grid representing a box of oranges. Each cell in the grid can have one of three values:
0 representing an empty cell. 1 representing a fresh orange. 2 representing a rotten orange. Every minute, any fresh orange that is adjacent (4-directionally) to a rotten orange becomes rotten.
Return the minimum number of minutes that must elapse until no cell has a fresh orange left. If this is impossible, return -1.
Ada AI
I want to discuss a solution
Help me solve this
Give more examples
What's wrong with my code?
How to use 'for loop' in javascript?
javascript (node 13.12.0)