A hard Python interview practice problem on DataDriven. Write and execute real python code with instant grading.
- Domain
- Python
- Difficulty
- hard
- Seniority
- L5
Problem
Given a 2D grid where 0 = empty, 1 = fresh orange, 2 = rotten orange, simulate minute-by-minute spread in 4 directions. Return the minimum minutes until all fresh oranges become rotten. Return -1 if any fresh orange is unreachable. Return 0 if there are no fresh oranges to begin with.
Summary
It starts with one, and then it spreads.
Practice This Problem
Solve this Python problem with real code execution. DataDriven runs your Python code in a real environment and grades it automatically.