DoorDash logo

DoorDash Software Engineer Coding Questions

40 practice questions for DoorDash Software Engineer interviews

DoorDash software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Medium Verified Question #1

1. Code Craft - Bootstrap API


Category: String coding problem

Question You are tasked with implementing a Bootstrap API that aggregates data from multiple services for a given user. Given a userId, you...

Input: String
Output: Computed result
Want to practise this one?
Create a free account to open the full question and practise DoorDash questions with AI.
Sign up free
coding Hard Verified Question #2

2. Code Craft - Driver Payment System


Category: Algorithm coding problem

Question You are in charge of implementing the Dasher payment model. Given the sequence of accepted/fulfilled order activities from a given dasher...

Input: List
Output: Computed result
coding Medium Verified Question #3

3. Find Closest Dasher


Category: Algorithm coding problem

Question You are given an m × n board representing a delivery area. The board contains: - 'X' - blockers (obstacles) - 'D' - DashMarts...

Input: List
Output: Integer
coding Medium Verified Question #4

4. Find Menu Changes


Category: Tree coding problem

Question You are given two tree structures representing an old menu and a new menu. Each tree node has: - key: identifier for the menu...

Input: List
Output: Computed result
coding Medium Verified Question #5

5. Location Index


Category: Graph coding problem
Implement a LocationIndex class that stores a set of named points on a 2D grid. The constructor takes three arrays: names (list of location name...
Input: 2D grid
Output: Computed result
coding Medium Verified Question #6

6. Covered Service Zones


Category: Algorithm coding problem
You are given two binary m x n matrices: coverage and demand. A cell in demand is active if its value is 1. Active cells that are...
Input: Number(s)
Output: Integer
coding Hard Verified Question #7

7. Wildcard Segment Counter


Category: String coding problem
You are given a template string consisting only of the characters '0', '1', and '?', and a list of integers run_lengths. A '?' in the...
Input: Array of integers
Output: Computed result
coding Medium Verified Question #8

8. Peak Value Processing Order


Category: Algorithm coding problem
You are given a list of unique integers values. At each step, identify all eligible values: a value is eligible if it is strictly greater than...
Input: List
Output: Computed result
coding Hard Verified Question #9

9. Directory Registry


Category: Tree coding problem
Implement a DirectoryRegistry class that manages a hierarchical key-value store modeled as a tree of paths. The root path "/" always exists with...
Input: String
Output: Computed result
coding Hard Verified Question #10

10. Ride Earnings Calculator


Category: String coding problem
You are given records, a list of ride events. Each record is a list of three strings: [ride_id, timestamp, status]. Possible statuses are...
Input: List
Output: Computed result
coding Medium Verified Question #11

11. Meeting Slot Generator


Category: Interval-based coding problem
Given a start time and an end time, generate all meeting check-in slots at 5-minute intervals after start up to and including end. The...
Input: List
Output: Computed result
coding Medium Verified Question #12

12. Catalog Tree Diff Counter


Category: Tree coding problem
You are given two n-ary trees representing an old and a new version of a product catalog. Each node in the tree has the following fields: - key...
Input: List
Output: Computed result
coding Hard binary search #1

1. [AI Enabled Coding] Dasher Payout and Promotion Reconciler


Scenario
DoorDash's Dasher earnings team needs a batch reconciler that calculates delivery earnings, preserves tips, and explains promotional adjustments. Operations uses its output to investigate payout discrepancies involving stacked deliveries and overlapping promotions. You may use an AI assistant while coding; the rules below are simplified exercise policies, not a statement of DoorDash's actual compensation policy.
Part 1 — Reconcile delivery earnings
  • Each delivery is a map with string keys and string values: delivery_id, dasher_id, accepted_min, completed_min, wait_minutes, and tip. Times are integer minute offsets on one shared timeline; money is a decimal string with exactly two fractional digits.

  • A delivery is active on the half-open interval [accepted_min, completed_min). For each Dasher, BASE_PAY is $0.30 per minute multiplied by min(2, active_delivery_count). Three simultaneous deliveries therefore earn $0.60 per minute, not $0.90. Inactive time earns nothing.

  • WAIT_BONUS is computed independently for every delivery: $0.20 × max(0, wait_minutes - 10). This bonus is additional to base pay.

  • TIPS is the sum of all tips and is never capped or reduced.

  • Return one result per Dasher, sorted lexicographically by dasher_id, containing base pay, wait bonus, tips, and total pay. Empty input returns an empty result. The return type is up to you; the examples show the required information as JSON. Represent monetary results exactly, without floating-point arithmetic.

  • Do not iterate over individual minutes: timestamps can be far apart. Build a design whose earnings rules can be extended independently.


Function signature: calculate_payout(deliveries: list[dict[str, str]])
Example 1:
Input:
{
  "deliveries": [
    {"delivery_id":"a","dasher_id":"d1","accepted_min":"0","completed_min":"20","wait_minutes":"12","tip":"2.00"},
    {"delivery_id":"b","dasher_id":"d1","accepted_min":"10","completed_min":"30","wait_minutes":"10","tip":"1.00"},
    {"delivery_id":"c","dasher_id":"d1","accepted_min":"15","completed_min":"25","wait_minutes":"0","tip":"0.00"},
    {"delivery_id":"d","dasher_id":"d2","accepted_min":"0","completed_min":"10","wait_minutes":"0","tip":"3.00"},
    {"delivery_id":"e","dasher_id":"d2","accepted_min":"10","completed_min":"20","wait_minutes":"10","tip":"0.00"}
  ]
}

Output:
[
  {"dasher_id":"d1","base_pay":"13.50","wait_bonus":"0.40","tips":"3.00","total_pay":"16.90"},
  {"dasher_id":"d2","base_pay":"6.00","wait_bonus":"0.00","tips":"3.00","total_pay":"9.00"}
]

Explanation: For d1, capped active-delivery minutes are 10×1 + 5×2 + 5×2 + 5×2 + 5×1 = 45, giving $13.50. Only delivery a exceeds the wait threshold, earning 2×$0.20 = $0.40; total pay is $13.50 + $0.40 + $3.00 = $16.90. For d2, the touching intervals contribute 20 active minutes, giving $6.00 + $3.00 = $9.00.
Part 2 — Apply independently configured promotions
Operations now supplies a second list of string-to-string maps named promotions. Every promotion applies independently to every Dasher appearing in the delivery input. Discuss how the return type changes to explain adjustments before implementing this extension. The approach must be flexible enough to support future promotion types without rewriting the Part 1 earnings rules.
  • A PEAK map contains rule_id, type, start_min, end_min, rate, and cap. Its raw reward is rate × capped active-delivery minutes within [start_min, end_min), using the same min(2, active_delivery_count) as base pay. Its credited reward is min(raw reward, cap). The cap applies separately to each Dasher and each rule. Overlapping PEAK rules stack; neither consumes another's cap.

  • A GUARANTEE map contains rule_id, type, min_deliveries, and amount. A Dasher qualifies when their number of input delivery records is at least min_deliveries. A qualifying rule credits max(0, amount - eligible_earnings), where eligible earnings include base pay, wait bonus, all PEAK rewards, and previously credited GUARANTEE adjustments, but exclude tips. A nonqualifying rule credits $0.00.

  • Evaluate all PEAK rules first, in lexicographic rule_id order, then all GUARANTEE rules in lexicographic rule_id order. Consequently, multiple guarantees establish a floor rather than being summed as separate bonuses.

  • Add an adjustments list to each result whenever the promotions argument is supplied, even if that argument is empty. Include every configured rule, including zero-dollar adjustments, in evaluation order. Each adjustment identifies rule_id and credited amount. Final total pay includes all adjustments and tips.

  • Avoid scanning a Dasher's entire delivery history separately for every PEAK rule. Preprocess a cumulative capped-workload representation so each promotion window can be evaluated in logarithmic time.


Extended signature: calculate_payout(deliveries: list[dict[str, str]], promotions: list[dict[str, str]] | None = None)
Example 2:
Input:
{
  "deliveries": [
    {"delivery_id":"a","dasher_id":"d1","accepted_min":"0","completed_min":"20","wait_minutes":"12","tip":"2.00"},
    {"delivery_id":"b","dasher_id":"d1","accepted_min":"10","completed_min":"30","wait_minutes":"10","tip":"1.00"},
    {"delivery_id":"d","dasher_id":"d2","accepted_min":"0","completed_min":"10","wait_minutes":"0","tip":"3.00"},
    {"delivery_id":"e","dasher_id":"d2","accepted_min":"10","completed_min":"20","wait_minutes":"10","tip":"0.00"}
  ],
  "promotions": [
    {"rule_id":"G_SHIFT","type":"GUARANTEE","min_deliveries":"2","amount":"15.00"},
    {"rule_id":"P_LUNCH","type":"PEAK","start_min":"10","end_min":"25","rate":"0.10","cap":"2.00"}
  ]
}

Output:
[
  {"dasher_id":"d1","base_pay":"12.00","wait_bonus":"0.40","tips":"3.00","adjustments":[{"rule_id":"P_LUNCH","amount":"2.00"},{"rule_id":"G_SHIFT","amount":"0.60"}],"total_pay":"18.00"},
  {"dasher_id":"d2","base_pay":"6.00","wait_bonus":"0.00","tips":"3.00","adjustments":[{"rule_id":"P_LUNCH","amount":"1.00"},{"rule_id":"G_SHIFT","amount":"8.00"}],"total_pay":"18.00"}
]

Explanation: d1 has 40 capped active-delivery minutes overall, yielding $12.00 base pay. In the PEAK window, 10×2 + 5×1 = 25 capped minutes yield $2.50, capped at $2.00. Eligible earnings become $12.00 + $0.40 + $2.00 = $14.40, so the guarantee adds $0.60; tips bring the total to $18.00. d2 has 10 capped minutes inside the PEAK window, earning $1.00; eligible earnings are $7.00, so the guarantee adds $8.00, followed by $3.00 in tips.
Example 3:
Input:
{
  "deliveries": [
    {"delivery_id":"x","dasher_id":"d1","accepted_min":"0","completed_min":"20","wait_minutes":"11","tip":"1.00"},
    {"delivery_id":"y","dasher_id":"d1","accepted_min":"0","completed_min":"20","wait_minutes":"12","tip":"2.00"},
    {"delivery_id":"z","dasher_id":"d1","accepted_min":"0","completed_min":"20","wait_minutes":"10","tip":"0.00"}
  ],
  "promotions": [
    {"rule_id":"G_C","type":"GUARANTEE","min_deliveries":"4","amount":"100.00"},
    {"rule_id":"P_B","type":"PEAK","start_min":"5","end_min":"15","rate":"0.20","cap":"2.00"},
    {"rule_id":"G_B","type":"GUARANTEE","min_deliveries":"3","amount":"20.00"},
    {"rule_id":"P_A","type":"PEAK","start_min":"0","end_min":"20","rate":"0.10","cap":"3.00"},
    {"rule_id":"G_A","type":"GUARANTEE","min_deliveries":"3","amount":"18.00"}
  ]
}

Output:
[
  {"dasher_id":"d1","base_pay":"12.00","wait_bonus":"0.60","tips":"3.00","adjustments":[{"rule_id":"P_A","amount":"3.00"},{"rule_id":"P_B","amount":"2.00"},{"rule_id":"G_A","amount":"0.40"},{"rule_id":"G_B","amount":"2.00"},{"rule_id":"G_C","amount":"0.00"}],"total_pay":"23.00"}
]

Explanation: All three deliveries overlap, but capped workload is 20×2 = 40 minutes, so base pay is $12.00. Deliveries x and y exceed the wait threshold, earning $0.20 + $0.40 = $0.60. Both PEAK rules fire on overlapping work: P_A earns 40×$0.10 = $4.00, capped at $3.00; P_B earns 10×2×$0.20 = $4.00, capped at $2.00. Eligible earnings are $17.60. G_A adds $0.40 to reach $18.00, G_B adds $2.00 to reach $20.00, and G_C adds nothing because there are only three deliveries. Tips are excluded from both guarantee calculations and bring total pay to $23.00.
Notes:
  • There are at most 100,000 deliveries and 100,000 promotions; the number of Dashers multiplied by the number of promotions is at most 200,000. Input lists may be unsorted.

  • Inputs are valid: delivery IDs and rule IDs are unique within their respective lists; 0 <= accepted_min < completed_min <= 10^9, 0 <= start_min < end_min <= 10^9, and wait minutes do not exceed delivery duration.

  • Monetary inputs are nonnegative, have exactly two fractional digits, and are at most $1,000,000.00; min_deliveries is a positive integer. There are no cancellations, duplicate records, time-zone conversions, or fractional minutes.
Want to practise this one?
Create a free account to open the full question and practise DoorDash questions with AI.
Sign up free
coding Hard tree #2

2. [Tree] — Maximum-value path between two live nodes


Background
A candidate-reported DoorDash coding interview used a binary-tree maximum-path-sum variant in which valid endpoints were leaf nodes, called “live nodes.” This exercise models that reported tree-processing task; it does not assume the endpoint rules of the standard maximum-path-sum problem.
Problem statement
You are given the root of a binary tree. Each node contains a signed integer value. A live node is a leaf: a node with no left child and no right child.
Return the maximum sum of node values along a simple path connecting two distinct live nodes. A path can traverse parent-child edges in either direction, cannot visit a node more than once, and includes both endpoints in its sum. Its endpoints must be leaves in the original rooted tree, not leaves created by considering only the selected path.
The best path need not pass through the root. Values may be negative, and you must not discard a negative segment if it is necessary to connect the two endpoints. Return None if the tree contains fewer than two live nodes.
Function or class signature
  • TreeNode(val: int, left: Optional[TreeNode] = None, right: Optional[TreeNode] = None) — binary-tree node representation.

  • max_live_node_path_sum(root: Optional[TreeNode]) -> Optional[int] — return the maximum valid path sum, or None when no valid path exists.


Example 1:
Input: root = [5, 2, -3, 4, -6, null, 7], using level-order serialization with null for missing children.
5
       / \
      2  -3
     / \   \
    4  -6   7
Output: 15
Explanation: The live nodes are 4, -6, and 7. The best path is 4 → 2 → 5 → -3 → 7, with sum 4 + 2 + 5 - 3 + 7 = 15. The other two leaf-to-leaf paths have sums 0 and 5.
Example 2:
Input: root = [-5, -2, -3].
-5
       / \
     -2  -3
Output: -10
Explanation: There are exactly two live nodes, so the only valid path is -2 → -5 → -3. Returning -2 would be incorrect because a single node is not a path between two distinct live nodes.
Constraints:
  • The tree contains between 0 and 200000 nodes.

  • Each node value is an integer in [-1000000000, 1000000000].

  • The input is a valid binary tree with no cycles or shared child nodes.

  • Tree height can equal the number of nodes; your implementation must handle this without exceeding the language's call-stack limit.

  • Use a signed 64-bit integer or an arbitrary-precision integer for path sums.

  • Target O(n) time, where n is the number of nodes.


Follow-up:
Return both the maximum sum and the actual sequence of node references along an optimal path, still in O(n) time. If multiple paths tie, any one is acceptable. Explain how to avoid copying a complete path at every node.
coding Medium caching #3

3. Caching System — Implement an LRU Cache

Background: DoorDash relies on caching to enhance the responsiveness of its application, especially for frequently accessed data such as restaurant menus and user order histories. An efficient caching mechanism like LRU (Least Recently Used) helps optimize resource usage and increase performance.
Problem statement: Design and implement a class LRUCache that supports the following operations: get(key) and put(key, value). The get method retrieves the value associated with the key if it exists, and also marks that key as recently used. The put method stores or updates the value associated with a specific key. If the cache exceeds its capacity, it should evict the least recently used item.
Function/class signature:
  • def get(self, key: int) -> int:

  • def put(self, key: int, value: int) -> None:


Example 1:
  • Input: cache = LRUCache(2); cache.put(1, 1); cache.put(2, 2); cache.get(1);

  • Output: 1 (Explanation: returns 1 as it is the value for key 1)


Example 2:
  • Input: cache.put(3, 3) (evicts key 2); cache.get(2);

  • Output: -1 (Explanation: returns -1 since key 2 was evicted)


Constraints:
  • 1 <= capacity <= 3000

  • 0 <= key <= 10^4

  • 0 <= value <= 10^4

  • get and put operations will be called at most 3 * 10^4 times in total.
coding Medium heap #4

4. Heap — Median of a Stream of Numbers

Background: In a real-time delivery service like DoorDash, understanding user preferences or delivery timeframes involves stream analysis, such as tracking customer ratings for their orders. This requires a mechanism to efficiently calculate the median of ratings as they come in over time.
Problem statement: Implement a class MedianFinder that supports the addition of numbers and can return the median of all added numbers efficiently. Ensure that the implementation uses two heaps to keep track of the lower half and the upper half of the numbers.
Function/class signature:
  • def addNum(self, num: int) -> None:

  • def findMedian(self) -> float:

Example 1:
  • Input:

medianFinder = MedianFinder()
medianFinder.addNum(1)
medianFinder.addNum(2)
medianFinder.findMedian()
  • Output:

1.5
  • Explanation: The numbers are [1,2], and the median is (1 + 2) / 2 = 1.5.

Example 2:
  • Input:

medianFinder.addNum(3)
medianFinder.findMedian()
  • Output:

2.0
  • Explanation: The numbers are [1, 2, 3], and the median is 2.

Constraints:
  • All input numbers are integers.

  • There will be at most 10000 calls to addNum and findMedian.

  • The input stream will be non-empty at the time of calls to findMedian.
coding Medium greedy #5

5. Heuristic search algorithm — Implement a function to calculate optimal Dasher routes

Background: DoorDash relies on efficient routing to ensure that food is delivered quickly and accurately. A well-designed routing algorithm can significantly reduce delivery times and improve customer satisfaction.
Problem statement: You need to implement a function that takes a list of delivery locations and computes the optimal route for Dashers, minimizing the total distance traveled. The function should use a simple heuristic to prioritize nearby deliveries first. Return the ordered list of delivery locations.
Function/class signature:
  • def optimal_dasher_route(locations: List[Tuple[float, float]]) -> List[Tuple[float, float]]:

Example 1: Input: [(1.0, 1.0), (2.0, 2.0), (3.0, 1.5)] Output: [(1.0, 1.0), (2.0, 2.0), (3.0, 1.5)] Explanation: The optimal path starts from the first location, goes to the second, and finally to the third.
Example 2: Input: [(5.0, 5.0), (1.0, 1.0), (2.0, 2.0)] Output: [(1.0, 1.0), (2.0, 2.0), (5.0, 5.0)] Explanation: The optimal path starts from the closest location at (1.0, 1.0).
Constraints:
  • 1 <= len(locations) <= 100

  • Locations are given in (latitude, longitude) format

  • Coordinate values will be between -10^[6] and 10^[6]
coding Medium concurrency #6

6. Concurrency — API to compute driver payouts with bonus multipliers

Background: DoorDash needs an efficient way to calculate driver payouts to ensure fair compensation for their services. This involves combining various bonus multipliers based on events like peak hours and completed deliveries.
Problem statement: You need to design an API that computes the total payout for a driver based on their events. Consider events as a list of tuples where each tuple contains a timestamp and a payout amount. Implement concurrency to handle situations where multiple bonus multipliers may apply.
Function/class signature:
  • def compute_driver_payout(events: List[Tuple[datetime, float]], bonus_multipliers: List[Tuple[str, float]]) -> float:


Example 1:
  • Input: events = [('2023-05-01T08:00:00', 10.0), ('2023-05-01T09:00:00', 5.0)], bonus_multipliers = [('peak_hour', 2.0), ('completing_5_deliveries', 1.5)]

  • Output: 37.5

  • Explanation: The driver earned $10 during a peak hour and $5 outside of it, applying multipliers results in $10*2 + $5*1.5 = $37.5.


Example 2:
  • Input: events = [('2023-05-01T10:00:00', 20.0), ('2023-05-01T11:00:00', 15.0)], bonus_multipliers = [('non_peak', 1.0), ('bonus_for_10_deliveries', 2.0)]

  • Output: 70.0

  • Explanation: Earnings are $20 + $15 = $35; applying multipliers yields $35*2 = $70.


Constraints:
  • 0 <= len(events) <= 100

  • 0 <= len(bonus_multipliers) <= 10

  • All payouts values are positive floats.

  • Events are sorted by timestamp.


Note: Handle concurrency issues when multiple threads may call this API to calculate payouts simultaneously.
coding Medium api design #7

7. Coding Challenge — API for Driver Payout Calculation

Background: DoorDash needs to compute driver payouts based on various factors such as delivery events and concurrency-based bonus multipliers. This requires a reliable API that can efficiently handle and process these events to calculate accurate payouts.
Problem statement: You are tasked with designing an API to compute driver payouts. Each driver can have multiple deliveries, and we need to calculate their total payout based on delivery events. Each event will have a base payout and may include bonuses based on concurrency rules. Implement the method compute_payout(driver_id: int, events: List[Tuple[int, float, int]]) -> float, which takes the driver's ID and a list of events where each event is a tuple containing:
  • event_time (int): The timestamp of the event in seconds.

  • base_payout (float): The base payout for the delivery.

  • bonus_multiplier (int): A bonus multiplier applied if certain conditions are met (e.g., if two deliveries are made within a specific time frame).

Function/class signature:
  • def compute_payout(driver_id: int, events: List[Tuple[int, float, int]]) -> float:

Example 1:
  • Input: driver_id = 1, events = [(1, 10.0, 1), (2, 15.0, 2)]

  • Output: 35.0

  • Explanation: The driver made two deliveries within the time frame eligible for bonuses, resulting in a total payout of $10 + $15 + (1 * 10) + (1 * 15) = $35.0.

Example 2:
  • Input: driver_id = 2, events = [(1, 5.0, 1), (10, 8.0, 2)]

  • Output: 13.0

  • Explanation: The driver made two deliveries without any bonus multiplier applied due to not meeting the concurrency condition.

Constraints:
  • 1 ≤ driver_id ≤ 10000

  • 0 ≤ event_time ≤ 10^6

  • 0 ≤ base_payout ≤ 1000

  • 1 ≤ bonus_multiplier ≤ 5

  • The length of events can be at most 1000.
coding Medium hash map #8

8. Hash Map — Count Unique Deliveries

Background: DoorDash needs to efficiently track the number of unique deliveries made by different drivers over a certain period to analyze performance metrics and optimize routing. This problem relates to the data management aspect of delivery logistics.
Problem statement: Given a list of driver IDs and the corresponding delivery timestamps, implement a function to count the number of unique deliveries for each driver. You must ensure that each driver's unique deliveries are counted based on distinct timestamps. Assume the timestamps are in the format YYYY-MM-DD HH:MM:SS and each driver can have multiple deliveries at the same timestamp.
Function/class signature:
  • def count_unique_deliveries(drivers: List[str], timestamps: List[str]) -> Dict[str, int]:

Example 1:
  • Input: drivers = ['A', 'A', 'B', 'A', 'B'], timestamps = ['2023-10-01 14:00:00', '2023-10-01 14:00:00', '2023-10-01 14:05:00', '2023-10-01 14:10:00', '2023-10-01 14:05:00']

  • Output: {'A': 3, 'B': 1}

  • Explanation: Driver A has delivered at three unique times, while driver B has only one unique time.

Example 2:
  • Input: drivers = ['C', 'C', 'C', 'C'], timestamps = ['2023-10-01 14:00:00', '2023-10-01 15:00:00', '2023-10-01 14:00:00', '2023-10-01 15:00:00']

  • Output: {'C': 2}

  • Explanation: Driver C has two unique delivery times.

Constraints:
  • 1 <= len(drivers) <= 10^4

  • 1 <= len(timestamps) <= 10^4

  • Timestamps are unique across the drivers but may repeat for the same driver.
coding Hard graph #9

9. [OA] Depth-First Search — Optimize Driver Matching for DoorDash

DoorDash needs to effectively match drivers to delivery requests based on location and time constraints.
Problem Statement: Given a grid of n x m representing a map where 1 represents an order location and 0 represents an empty space, implement a function maxDrivers(orders: List[List[int]], start: Tuple[int, int]) -> int that returns the maximum number of deliveries that can be assigned to drivers originating from start position.
Example 1:
Input: orders = [[0,0,0],[0,1,0],[0,0,0]], start = (1, 1)
Output: 1
Explanation: The only reachable order is at (1,1).
Constraints:
  • 1 <= orders.length, orders[i].length <= 20

  • 0 <= start[0] < orders.length

  • 0 <= start[1] < orders[i].length
coding Hard sliding window #10

10. [OA] Sliding Window — Design a delivery tracking system for DoorDash

DoorDash needs a robust method to track orders and ensure timely deliveries based on real-time traffic data.
Problem Statement: Given an array of integers representing the estimated delivery times for incoming orders, implement a function maxDeliveryTime(orders: List[int], k: int) -> int that returns the maximum possible delivery time over any sub-array of size k, where k is the number of concurrent deliveries.
Example 1:
Input: orders = [2, 1, 3, 5, 6, 4], k = 3
Output: 14
Explanation: The best sub-array is [5, 6, 4], which yields a delivery time of 5 + 6 + 4 = 15.
Constraints:
  • 1 <= orders.length <= 100000

  • 1 <= orders[i] <= 1000

  • 1 <= k <= orders.length

Related DoorDash Software Engineer interview prep

Start practicing DoorDash questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free