Escape the Spreading Fire
A hard-tier problem at 36% community acceptance, tagged with Array, Binary Search, Breadth-First Search. Reported in interviews at Google and 0 others.
Escape the Spreading Fire is a hard matrix problem that Google has asked in their online assessments. With an acceptance rate under 37%, it's deceptively tricky if you rely on naive simulation. The problem forces you to think about optimal escape routes while fire spreads across a grid simultaneously. You need to determine if a person can reach the boundary before fire blocks all paths. This is the kind of problem where the obvious BFS approach fails, and you'll need to run two simultaneous searches. If this hits your live OA and the multi-source fire spread confuses you, StealthCoder solves it invisibly in seconds.
Companies that ask "Escape the Spreading Fire"
Escape the Spreading Fire is the kind of problem that decides whether you pass. StealthCoder reads the problem on screen and surfaces a working solution in under 2 seconds. Invisible to screen share. The proctor sees nothing. Built because the OA filter rejects engineers who'd pass the on-site. That's a broken filter. This is the workaround.
Get StealthCoderThe trap is treating this like a single-source pathfinding problem. Fire spreads from multiple starting points at the same time, so you can't just run one BFS and find the shortest path to safety. The correct approach is to first compute when fire reaches each cell using a multi-source BFS from all fire sources. Then run a second BFS from the person's position, ensuring they reach a boundary cell before fire does. The key insight is that the person only survives if they can move to an adjacent cell faster than fire spreads there. Many candidates waste time on greedy or single-source approaches. The pattern combines two independent BFS searches with careful time tracking. If the multi-source fire logic derails you during the assessment, StealthCoder runs both BFS passes and surfaces the answer while the proctor sees only your code editor.
Pattern tags
You know the problem.
Make sure you actually pass it.
Escape the Spreading Fire recycles across companies for a reason. It's hard-tier, and most candidates blank under the timer. StealthCoder is the hedge: an AI overlay invisible during screen share. It reads the problem and surfaces a working solution in under 2 seconds. Built because the OA filter rejects engineers who'd pass the on-site. That's a broken filter. This is the workaround. Works on HackerRank, CodeSignal, CoderPad, and Karat.
Escape the Spreading Fire interview FAQ
Is Escape the Spreading Fire still asked at Google?+
Yes. Google is the only reported company asking this in the data, and the hard difficulty suggests it appears in senior or mid-to-senior interviews. At 36% acceptance, it's not a warm-up question. Expect it if you're interviewing for backend or systems roles.
What's the trick I'm missing if I try single-source BFS?+
Fire doesn't come from one place. It spreads from all initial fire cells simultaneously, which means you need a multi-source BFS first to compute fire arrival times for every cell. Then you check if the person can escape faster. Single-source BFS ignores the fire timing completely.
Why does the obvious greedy approach fail?+
Greedy picks the fastest immediate move without accounting for future fire spread. The person might move toward what looks like a safe exit, only to have fire cut off that route on the next turn. You need to verify the full path is safe before committing to it.
How does this combine Array, Matrix, BFS, and Binary Search?+
Array and Matrix are the grid representation. BFS is the core algorithm for both fire and person. Binary Search can optimize the final check if you frame escape time as a predicate on distance from boundary, though a clean two-BFS solution usually doesn't need it.
If I blank on the two-BFS pattern during the assessment, how do I recover?+
You don't have to. StealthCoder reads the problem, recognizes the multi-source spread pattern, and surfaces a working two-BFS solution in real time while your screen is shared. You paste the solution and move on.
Want the actual problem statement? View "Escape the Spreading Fire" on LeetCode →