Algorithm · DoorDash · Medium
(This problem adapts LeetCode 286: Walls and Gates. Solving that one first is recommended.) You are given a 2D city grid where: 'D' is a DashMart. ' ' is a traversable road. 'X' is a blocked road that cannot be entered. You also receive a list of locations, each a [row, col] coordinate. For every queried location, compute the minimum number of steps needed to reach any DashMart. Movement is allowed one step at a time to the four orthogonal neighbors (up, down, left, right),…
Checking your access…