← DoorDash Interview Insights

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

DoorDash coding interview with two back-to-back problems, one on pay calculation and one on request routing. The problems felt very on-brand for a delivery company which was either clever or on the nose depending on your mood. Decent difficulty, nothing impossible, but the second one had a part B that could spiral if you weren't careful.

Questions Asked (2)

Q1

Given a list of pay-rate intervals and a list of delivery trips, compute the total pay for a courier. Trips earn time-based pay according to the rate schedule plus a flat bonus per trip, and you need to handle gaps in the rate schedule and trips that span multiple intervals.

Algorithms & Data Structures
Author's notes

The core idea clicked pretty fast: sort the intervals, then for each trip do a sweep over the relevant intervals and accumulate.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the input format and edge cases, then propose an efficient algorithm that sorts intervals and uses binary search or a sweep line to compute pay for each trip. Walk through a concrete example to demonstrate handling of gaps and multi-interval trips, and analyze time and space complexity.

Pro tip: Mention that you would preprocess the rate schedule into a sorted list of non-overlapping intervals with cumulative pay to enable O(log n) queries per trip, showing awareness of scalability for large datasets.

1. Clarify requirements and edge cases

Ask about input format, whether intervals are sorted, how gaps are defined, and if trips can span multiple intervals. Confirm the flat bonus per trip and whether it applies to all trips.

2. Design data structures and preprocessing

Sort intervals by start time and merge overlaps if necessary. Precompute cumulative pay for each interval to allow quick calculation of pay over any sub-interval.

3. Compute pay per trip

For each trip, find overlapping intervals using binary search. For each overlap, compute the duration within that interval and multiply by the rate, then sum and add the flat bonus.

4. Handle gaps and multi-interval trips

If a trip spans a gap, treat the gap as zero pay. Ensure the algorithm correctly splits the trip across multiple intervals and sums the contributions.

5. Analyze complexity and test

State time complexity: O(n log n) preprocessing + O(m log n) for m trips. Space complexity: O(n). Walk through a small example to verify correctness.

Key Points to Mention

  • Sorting intervals and using binary search for efficient overlap detection
  • Precomputing cumulative pay to enable O(1) pay calculation for any sub-interval
  • Handling gaps by treating them as zero-pay regions
  • Splitting trips that span multiple intervals and summing pay per segment
  • Adding the flat bonus per trip after computing time-based pay
  • Time and space complexity analysis and potential optimizations for large inputs

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

Q2

Design an in-memory request router. First implement round-robin routing with add/remove server support, then extend it to use consistent hashing so that server changes only remap a small fraction of requests.

System DesignAlgorithms & Data StructuresTechnical Trade-offs
Author's notes

Part A was fine.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and constraints, then implement round-robin routing with add/remove server support using a simple list and index. Next, explain the limitations of round-robin for caching and introduce consistent hashing with a hash ring and virtual nodes to minimize remapping. Finally, discuss trade-offs and potential optimizations.

Pro tip: Mention that consistent hashing with virtual nodes is used in real systems like Cassandra and DynamoDB to balance load and minimize disruption, showing you understand production-grade design.

1. Clarify Requirements

Ask about expected scale, concurrency, server addition/removal frequency, and whether requests have keys (e.g., user IDs) that need stickiness.

2. Implement Round-Robin

Use a circular list of servers and an index to pick the next server. For add/remove, update the list and adjust the index carefully to avoid skipping or repeating servers.

3. Identify Round-Robin Limitations

Explain that round-robin doesn't consider request keys, so adding/removing servers remaps many requests, which is bad for caching and stateful sessions.

4. Design Consistent Hashing

Map servers and request keys to a hash ring (e.g., using a sorted array or balanced tree). Use virtual nodes per server to improve load distribution. For a request, hash its key and find the next server clockwise on the ring.

5. Analyze Trade-offs and Optimizations

Discuss how consistent hashing reduces remapping to ~1/N of keys when a server is added/removed. Mention virtual node count tuning, replication for fault tolerance, and potential hotspots.

Key Points to Mention

  • Round-robin implementation details: circular list, index management for add/remove.
  • Consistent hashing ring: hash function (e.g., MD5, SHA-1), sorted structure for efficient lookup.
  • Virtual nodes: purpose (load balancing), typical number (e.g., 100-200 per server).
  • Remapping fraction: only keys that map to the changed server's range are remapped.
  • Trade-offs: consistent hashing adds complexity but improves cache hit rate and reduces disruption.
  • Real-world examples: Cassandra, DynamoDB, memcached clients use consistent hashing.

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