Reported February 2024
Intuitbreadth first search

Spreading Fire (Intuit India)

Reported by candidates from Intuit's online assessment. Pattern, common pitfall, and the honest play if you blank under the timer.

Get StealthCoderRuns invisibly during the live Intuit OA. Under 2s to a working solution.
Founder's read

Intuit asked this in February 2024, and it's a classic multi-source BFS disguised as a fire simulation. You're given a grid, fire starts at one or more cells, and spreads to adjacent cells each turn. The trap is thinking you need to simulate the entire spread. You don't. You need to find which cells the fire reaches before a person can escape, or count turns until containment. StealthCoder will surface the BFS pattern instantly if you freeze on the approach.

Pattern and pitfall

This is breadth-first search from multiple sources simultaneously. Fire spreads level by level, visiting all neighbors before moving deeper. The key insight: model this as a multi-source BFS where all fire cells are enqueued first, then you process them in order of distance from the nearest fire source. Common pitfall is single-source BFS or trying to simulate time steps naively. The pattern is also used for problems like 'Rotting Oranges' and 'Walls and Gates'. If the problem asks 'can a person escape', you layer a second BFS for the person's movement, or compare arrival times. On the live OA, if you blank on the setup, having BFS structure in your pocket saves 10 minutes.

Drill it cold or hedge it with StealthCoder. Either way, don't walk into the OA hoping you remember the trick.

If this hits your live OA

You can drill Spreading Fire (Intuit India) cold, or you can hedge it. StealthCoder runs invisibly during screen share and surfaces a working solution in under 2 seconds. The proctor sees the IDE. They don't see what's behind it. Made for the candidate who got the OA invite this morning and has 72 hours, not six months.

Get StealthCoder

Related leaked OAs

⏵ Practice the LeetCode equivalent

This OA pattern shows up on LeetCode as rotting oranges. If you have time before the OA, drill that.

⏵ The honest play

You've seen the question. Make sure you actually pass Intuit's OA.

Intuit reuses patterns across OAs. Made for the candidate who got the OA invite this morning and has 72 hours, not six months. Works on HackerRank, CodeSignal, CoderPad, and Karat.

Spreading Fire (Intuit India) FAQ

Is this just simulation or is there an algorithmic trick?+

It's BFS. Fire spreading level-by-level is textbook multi-source shortest path. Simulation will time out. Set up a queue, enqueue all fire cells with distance 0, then process neighbors. That's the trick.

What if the problem asks whether a person can escape?+

Run BFS for fire to find the turn each cell burns. Then run BFS for the person from their starting cell, only moving to cells that burn later than their arrival time. Compare the person's time to exit vs fire's time to reach the exit.

How do I handle diagonal vs orthogonal movement?+

Check the problem statement. Most grid fire problems use only 4 directions (up, down, left, right). If diagonals are allowed, add 4 more directions to your neighbor list. Intuit problems usually stick to 4-directional.

What's the time complexity I should expect?+

O(rows * cols) for multi-source BFS. You visit each cell once and add/remove from queue once. Space is O(rows * cols) for the queue and distance tracking. Should be well under limits.

Is this problem still asked after 2024?+

Multi-source BFS and grid fire problems are evergreen. Intuit and similar companies ask grid traversal constantly. Understanding the pattern matters more than memorizing this exact problem.

Problem reported by candidates from a real Online Assessment. Sourced from a publicly-available candidate-aggregated repository. Not affiliated with Intuit.

OA at Intuit?
Invisible during screen share
Get it