Intuition
Not much to this problem other than being mindful of some edge cases introduced by the problem statement.
Some considerations:
if there is an isolated component of fresh oranges, its impossible for them to become rotten.
if all oranges are already rotten, then zero time is required for all to become rotten.
Other than these considerations, the problem is a basic BFS with cycle prevention. We can use the grid itself for cycle prevention instead of creating more memory for a visited set.