Amazon | FB interview question
Anonymous User
1910

The question is similar to minesweeper https://leetcode.com/problems/minesweeper/
You will get input location of all mines and their blast radius. There will be a chain reaction when a bomb explodes and it would trigger other bombs in it's vicinity. Given this, you need to return how the matrix looks like after some t seconds. Consider this as you're playing the minesweeper game and land on a mine.

Input:
B   M2     B      B       B 
B   B      B      B       B 
B   M1     B      B       M1 
B   B      B      B       B 

Where B is empty space, M[n] is the mine with the blast radius n.

Output: 
B   X      B      B       B 
B   B      B      B       B 
B   X      B      B       M1 
B   B      B      B       B 

After 1 second or first processing where t=1.

I tried using BFS.

I was asked this question in both Amazon and FB, but couldn't find online.
Comments (2)