Doordash Interview Question
Anonymous User
1994
Oct 21, 2025
Oct 21, 2025

A DashMart is a warehouse run by Doordash that houses items found in convenience stores, grocery stores, and restuarants. We have a city with open roads, blocked-off roads, and DashMarts.
City Planners want you to identify how far a location is from it's closest DashMart. You can only travel over open roads (up, down, left, right). Locations are given in [row, col] format.

Example 1

[ ['X', ' ', ' ', 'D', ' ', ' ', 'X', ' ', 'X'],
['X', ' ', 'X', 'X', ' ', ' ', ' ', ' ', 'X'],
[' ', ' ', ' ', 'D', 'X', 'X', ' ', 'X', ' '],
[' ', ' ', ' ', 'D', 'X', 'X', ' ', 'X', ' '],
[' ', ' ', ' ', ' ', ' ', 'X', ' ', ' ', 'X'],
[' ', ' ', ' ', ' ', 'X', ' ', ' ', 'X', 'X'] ]
such that: ' ' represents an open road that you can travel over in any direction (up, down, left, or right)
'X' represents an blocked road that you cannot travel through.
'D' represents a DashMart.
locations = [[200, 200], [1, 4], [0, 3], [5, 8], [1, 8], [5, 5]]
Return a list of the distances from a given point to its closest DashMart.
Expected Answer: In this case, you should return [-1, 2, 0, -1, 6, 9]

Follow-up : Find dashmart that can server maximum customers. Customers will be served by their closest dashmart. Customers are represented by ‘C’ in the city plan

Comments (2)