Ajay has a flight to catch in an hour. So he has to reach the airport as fast at possible. He hires a taxi and promises the taxi driver that if he reaches the airport within k minutes he would pay the taxi driver double the amount.
The city description is as follows –
The taxi is at point 0,0 & airport is at (n-1,m-1) in a 2 – D grid of n rows and m columns. The grid has some blocked (represented as’#’) and some unblocked (represented as’.’) cells.
The starting position of the taxi is in the top – left corner of the grid. It is guaranteed that the starting position & ending positions are not blocked. Each cell of the grid is connected with its right ,left,top,bottom cells (if those cells exist ). It takes 1 second for a taxi to move from a cell to its adjacent cell.
If the taxi can reach the bottom-right (airport) corner of the grid within k seconds, return the string ‘Yes’. Otherwise , return the string ‘No’.
It will take the taxi 5 seconds to reach the bottom right corner. As long as k>_5,return
String;the final string; either ‘yes’ or ‘ No’
Input Format For Custom Testing
The first line contains an integer,rows that denotes the number of rows of the 2-D grid
In each of the next rows lines, the i^th line contains a string denoting the configuration of the i^th row of the grid.
The last line contains an integer, maxTime ,that represents the maximum time in seconds the taxi has to reach the bottom right cell.
Sample Input 0
2 -> size of grid rows =2
.. -> grid = [‘..’,’..’]
3 -> maxTime = 3
The grid has 2 rows and 2 columns and the time within which the taxi needs to reach the bottom-right cell in 3 seconds. Starting from the top-left cell, the taxi can either move to the top-right unblocked