Doordash phone interview

Posted
18 Jun 2025
350 reads

Summary

This post describes a Doordash phone interview experience, detailing a specific algorithmic problem called 'Closest DashMart' which involves finding the distance to the nearest DashMart in a grid.

How it went

Closest DashMart

Problem Statement A DashMart is a warehouse run by DoorDash that houses items found in convenience stores, grocery stores, and restaurants. We have a city with open roads, blocked-off roads, and DashMarts.

City planners want you to identify how far a location is from its closest DashMart.

You can only travel over open roads (up, down, left, right).

Locations are given in [row, col] format.

Example 1 [

0 1 2 3 4 5 6 7 8

['X', ' ', ' ', 'D', ' ', ' ', 'X', ' ', 'X'], # 0
['X', ' ', 'X', 'X', ' ', ' ', ' ', ' ', 'X'], # 1
[' ', ' ', ' ', 'D', 'X', 'X', ' ', 'X', ' '], # 2
[' ', ' ', ' ', 'D', ' ', 'X', ' ', ' ', ' '], # 3
[' ', ' ', ' ', ' ', ' ', 'X', ' ', ' ', 'X'], # 4
[' ', ' ', ' ', ' ', 'X', ' ', ' ', 'X', 'X']  # 5

]

' ' 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.

list of pairs [row, col]

locations = [ [200, 200], [1, 4], [0, 3], [5, 8], [1, 8], [5, 5]
]

answer = [-1, 2, 0, -1, 6, 9]

Provided:

  • city: char[][]
  • locations: int[][2]

Return:

  • answer: int[] Return a list of the distances from a given point to its closest DashMart.

Questions asked (1)

  1. 01

    Closest DashMart

    Data Structures & Algorithms

    A DashMart is a warehouse run by DoorDash that houses items found in convenience stores, grocery stores, and restaurants. We have a city with open roads, blocked-off roads, and DashMarts.

    City planners want you to identify how far a location is from its closest DashMart.

    You can only travel over open roads (up, down, left, right).

    Locations are given in [row, col] format.

    Example 1 [

    0 1 2 3 4 5 6 7 8

    ['X', ' ', ' ', 'D', ' ', ' ', 'X', ' ', 'X'], # 0
    ['X', ' ', 'X', 'X', ' ', ' ', ' ', ' ', 'X'], # 1
    [' ', ' ', ' ', 'D', 'X', 'X', ' ', 'X', ' '], # 2
    [' ', ' ', ' ', 'D', ' ', 'X', ' ', ' ', ' '], # 3
    [' ', ' ', ' ', ' ', ' ', 'X', ' ', ' ', 'X'], # 4
    [' ', ' ', ' ', ' ', 'X', ' ', ' ', 'X', 'X']  # 5
    

    ]

    ' ' 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.

    list of pairs [row, col]

    locations = [ [200, 200], [1, 4], [0, 3], [5, 8], [1, 8], [5, 5]
    ]

    answer = [-1, 2, 0, -1, 6, 9]

    Provided:

    • city: char[][]
    • locations: int[][2]

    Return:

    • answer: int[] Return a list of the distances from a given point to its closest DashMart.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at DoorDash recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!