← DoorDash Interview Insights

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jun 2026

Summary

DoorDash software engineer interview with two coding problems. The first was a classic string matching problem and the second was a grid BFS tied to a DoorDash-flavored scenario. Nothing too shocking but the second one had some teeth once follow-ups came in.

Questions Asked (2)

Q1

Implement a string-matching function that returns the index of the first occurrence of a pattern within a text string.

Algorithms & Data Structures
Author's notes

Pretty much a direct strStr implementation.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the problem constraints (e.g., input sizes, character set, whether the pattern can be empty) and then propose a straightforward brute-force solution. After establishing correctness, discuss more efficient algorithms like KMP or Rabin-Karp, explaining their trade-offs. Finally, walk through a concrete example to demonstrate the algorithm's steps and edge cases.

Pro tip: Mention that in real-world systems like DoorDash, string matching is often used in search and routing, so considering performance and memory for large inputs is crucial. Also, explicitly state the time and space complexity of each approach and justify your final choice.

1. Clarify requirements and constraints

Ask about input sizes, character set, whether the pattern can be empty, and expected return value if no match is found. This ensures you handle edge cases and choose an appropriate algorithm.

2. Propose a brute-force solution

Describe a simple O(n*m) approach that checks each possible starting position in the text. This demonstrates you can start with a correct baseline before optimizing.

3. Discuss optimized algorithms

Introduce KMP (O(n+m)) or Rabin-Karp (average O(n+m)) and explain how they improve efficiency by avoiding redundant comparisons. Mention when each is preferable.

4. Walk through an example

Trace the chosen algorithm on a small example (e.g., text='abxabcabcaby', pattern='abcaby') to show step-by-step how the index is found and how edge cases are handled.

5. Analyze complexity and trade-offs

State the time and space complexity of each approach and justify your final recommendation based on the constraints. Mention any practical considerations like memory usage or implementation complexity.

Key Points to Mention

  • Time and space complexity of brute-force vs. KMP vs. Rabin-Karp
  • Handling edge cases: empty pattern, pattern longer than text, no match found
  • The concept of a prefix function (or failure function) in KMP
  • Rolling hash and collision handling in Rabin-Karp
  • Real-world applications of string matching in search and routing
  • Trade-offs between simplicity and performance

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.

Q2

Given a 2D grid representing a delivery map with a start position, obstacles, and multiple target pickup locations, write a BFS solution to find the minimum number of steps to collect all required items. Then discuss how you would optimize the approach.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The DoorDash theming made it feel less dry than a generic grid problem, but the core is still BFS.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem constraints and edge cases (e.g., grid size, number of targets, obstacles). Then, present a BFS solution that models the state as (position, collected items bitmask) to find the minimum steps to collect all items. Finally, discuss optimizations such as precomputing distances between key points and using dynamic programming to reduce the state space.

Pro tip: Mention that for a small number of targets (≤10), the bitmask BFS is efficient, but for larger numbers, precomputing pairwise distances and using DP (TSP-like) is more scalable. This shows you consider trade-offs and scalability.

1. Clarify the problem

Ask about grid size, number of targets, obstacles, and whether all items must be collected. Confirm if movement is 4-directional and if revisiting cells is allowed.

2. Design BFS with state

Use BFS where each state is (row, col, mask) where mask represents collected items. Start from initial position with mask=0, and goal is any state with mask = (1<<k)-1.

3. Implement BFS

Use a queue for BFS, a visited set to avoid revisiting states, and track steps. For each move, update mask if the new cell contains a target.

4. Analyze complexity

Time complexity: O(R*C*2^k), space: O(R*C*2^k). Discuss how this scales with k and grid size.

5. Discuss optimizations

For larger k, precompute distances between start and targets (and between targets) using BFS from each key point, then use DP (Held-Karp) to find shortest path visiting all targets. This reduces to O(k^2 * 2^k) after precomputation.

Key Points to Mention

  • State representation with bitmask to track collected items.
  • BFS guarantees shortest path in unweighted grid.
  • Handling obstacles and boundaries.
  • Time and space complexity trade-offs.
  • Precomputing pairwise distances for optimization.
  • Dynamic programming (TSP) for larger number of targets.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.