Algorithm · DoorDash · Medium
Requirements Input: You receive a two-dimensional character grid: x marks an obstacle, d marks a destination, and . represents a cell that can be traversed. Output: Return an integer grid with identical dimensions, where each entry is the minimum number of orthogonal moves needed to reach the closest d. Edge case to discuss with the interviewer: Distances must be defined for obstacle cells too. Ask whether x should be considered unreachable (such as −1 or $$\infty$$) or…
Checking your access…