Doordash | Phone | Least time for dasher to reach destination
Difficulty: EASYCategory: InterviewExperienceFrequency: 1Asked On 2022-07-07Added By Anonymous
Source: Link
DoorDash | Phone | Least time for dasher to reach destination
Question Statement: Here is an n*n map where grid[i][j] represents the number of blockers in the position (i, j). In every unit of time, the number of blockers in every position will be decreased by one. Every position with one or more blockers is not accessible. Assume you are a dasher at DoorDash. You can drive from one position to another 4-directionally adjacent position if and only if the position is accessible. You will start at the top left position (0, 0) and your goal is to reach the bottom right position (n-1, n-1). Assuming you can drive infinite distances in zero time, what would be the least time that you can reach the destination? Constraints: * n == grid.length * n == grid[i].length * 1 <= n <= 50 * 0 <= grid[i][j] < n^2 * Each value grid[i][j] is unique. Example 0 1 2 3 4 24 16 22 21 5 12 13 14 15 23 11 17 18 19 20 10 9 8 7 6 input: int[][] grid output: 16 (int) explanation: 0->1->16->13->12->11->10->9->8->7->6, largest cell value in path is 16 [for backend senior software engineer NYC]
Question Statement: Here is an n*n map where grid[i][j] represents the number of blockers in the position (i, j). In every unit of time, the number of blockers in every position will be decreased by one. Every position with one or more blockers is not accessible. Assume you are a dasher at DoorDash. You can drive from one position to another 4-directionally adjacent position if and only if the position is accessible. You will start at the top left position (0, 0) and your goal is to reach the bottom right position (n-1, n-1). Assuming you can drive infinite distances in zero time, what would be the least time that you can reach the destination? Constraints: * n == grid.length * n == grid[i].length * 1 <= n <= 50 * 0 <= grid[i][j] < n^2 * Each value grid[i][j] is unique. Example 0 1 2 3 4 24 16 22 21 5 12 13 14 15 23 11 17 18 19 20 10 9 8 7 6 input: int[][] grid output: 16 (int) explanation: 0->1->16->13->12->11->10->9->8->7->6, largest cell value in path is 16 [for backend senior software engineer NYC]