OpenAI·Software Engineer·Technical Phone Screen
- Given an m x n grid with empty cells, healthy people, and infected people, find the minimum number of minutes for all healthy people to become infected via 4-directional spread each minute. Return -1 if it's impossible.
- Follow-up: some cells are immune and cannot be infected. How does your solution change, and when should you return -1?
- Follow-up: multiple infection sources spread at different rates or with different infection probabilities. How would you model and solve this?
- Follow-up: the grid receives streaming updates where new infected cells appear over time. How do you maintain the answer incrementally without recomputing from scratch?
“Classic multi-source BFS, I knew it immediately.”