Hotstar+Disney Interview question
Anonymous User
3382

Given a N x M Grid. It has dots (walkable points) X (restriced points). 
You need to make an attempt to cross the Grid by entering from north and exiting from South.
Everyday you can make only one attempt to cross the grid.
Everyday there will be one more obstacle added to the grid.
Identify after which day it will be impossible to cross the grid

Notes: You can enter the grid from North only and exit it from only South.
Once you enter the grid you can move in all 8 directions
You cannot exit the grid from any other direction once you enter it.

Example test Case -

3 3
..X
.XX
.XX
3
0 0
0 1
2 0

In this case, output is 2.
Since on day 2, after obstacle is put at 0 1, the whole path is block.

Comments (4)