DoorDash Techinal Screening | Software Engineer
Anonymous User
1275

DoorDash optimizes Dasher efficiency by assigning multiple orders from nearby restaurants to the same Dasher. This is called order stacking. Given a city map consisting of restaurants that have orders ready to be picked up at a specified time, determine the maximum number of orders that can be stacked/assigned to a single Dasher. Cell i, j of city represents a restaurant and city[i][j] represents the time at which an order is ready to be picked up from the restaurant.
An order can be assigned to the same Dasher if:

  1. The next restaurant is directly adjacent to the previous restaurant where an order was picked up and
  2. The pickup time for the next order is after the pickup time of the last order that was picked up
    Example 1:
    Provided:
city = [
			[9 ,9 ,4]
			[6 ,6 ,8]
			[2 ,1 ,1]
		]

Output = 4

Solved it with DFS. Took some hints from the interviewer, but was able to Solve it. Havent heard back from them in a while.

Comments (3)