← DoorDash Interview Insights

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

IntermediatePrefer not to say
Apr 2026Remote

Summary

DoorDash coding screen for a software engineer role. The main problem was a payout calculator for a delivery platform, which sounds straightforward until you hit the edge cases around surge windows and deduplication. Follow-ups pushed into system design territory pretty fast.

Questions Asked (4)

Q1

Given a list of delivery records with timing and rate data, a set of already-paid delivery IDs, and a list of surge windows with multipliers, compute the total payout in cents for a single driver and return the delivery IDs that should be marked as paid.

Algorithms & Data StructuresPricing & Monetization
Author's notes

The core logic took me a while to structure cleanly.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the data model and business rules: how delivery records, paid IDs, and surge windows are structured, and how surge multipliers apply (e.g., per delivery or per time window). Then outline an algorithm that filters unpaid deliveries, computes each delivery's payout using rate and surge, sums the total in cents, and collects the IDs to mark as paid. Emphasize efficiency (e.g., O(n log n) or O(n)) and correctness with edge cases.

Pro tip: Mention that you would use integer arithmetic (cents) to avoid floating-point errors, and that you'd confirm whether surge windows are inclusive/exclusive and how overlapping windows are handled—these details often trip up candidates.

1. Clarify requirements and data structures

Ask about the format of delivery records (e.g., ID, timestamp, base rate, duration), paid IDs (set or list), and surge windows (start/end time, multiplier). Confirm how surge applies: per delivery based on its start time, or prorated over its duration.

2. Filter unpaid deliveries

Use a hash set of paid IDs for O(1) lookups to efficiently exclude already-paid deliveries from further processing.

3. Compute payout per delivery

For each unpaid delivery, determine the applicable surge multiplier by checking which surge window(s) contain its time (handle overlaps per business rules). Multiply the base rate by the multiplier, ensuring integer arithmetic in cents.

4. Aggregate total and collect IDs

Sum the payouts for all unpaid deliveries to get the total payout in cents, and collect their IDs into a list to return as the deliveries to mark as paid.

5. Handle edge cases and optimize

Consider edge cases: no unpaid deliveries, no surge windows, overlapping surge windows, deliveries spanning multiple windows, and large input sizes. Optimize by sorting surge windows and using binary search if needed.

Key Points to Mention

  • Use a hash set for paid IDs to achieve O(1) membership checks.
  • Represent all monetary values in cents as integers to avoid floating-point precision issues.
  • Clarify surge multiplier application: per delivery based on start time, or prorated over duration.
  • Handle overlapping surge windows according to business rules (e.g., take max multiplier or apply sequentially).
  • Return both the total payout (in cents) and the list of delivery IDs to mark as paid.
  • Analyze time complexity: O(n + m) with hash set and linear scan, or O(n log m) if sorting surge windows for binary search.

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

Q2

How would you make the payout operation idempotent if the payment API can time out and the job might be retried?

System DesignTechnical Trade-offs
Author's notes

Blanked for a second.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by explaining that idempotency ensures a payout is processed exactly once even if the request is retried due to timeouts. Propose using a unique idempotency key per payout request, stored server-side with the operation's state, so retries can detect and return the original result. Then discuss implementation details like key generation, storage, and handling concurrent requests.

Pro tip: Emphasize that idempotency must be enforced on the server side, not just the client, and that the idempotency key should be tied to the business operation (e.g., payout ID) rather than the HTTP request. Also mention the importance of setting an appropriate expiration for idempotency records to avoid unbounded storage growth.

1. Define the idempotency key

Generate a unique key for each payout operation, such as a client-generated UUID or a deterministic hash of the payout details. This key must be sent with every retry of the same operation.

2. Store key and state atomically

Use a database or distributed cache to store the idempotency key along with the operation's status (e.g., pending, succeeded, failed) and the response. Ensure the write is atomic to handle concurrent requests.

3. Check key before processing

On each request, first check if the idempotency key exists. If it does, return the stored response (or appropriate status) without re-executing the payout. If not, proceed but mark as pending.

4. Handle timeouts and retries

If the payment API times out, the operation remains pending. On retry, the system sees the pending state and can either wait, retry the payment API with the same idempotency key (if supported), or return a conflict.

5. Clean up and expire keys

Set a TTL for idempotency records to prevent indefinite storage. After the TTL, the same key could be reused, but ensure it's long enough to cover retry windows.

Key Points to Mention

  • Idempotency key generation and propagation (client to server)
  • Atomic storage of key and operation state (e.g., using transactions or conditional writes)
  • Handling concurrent duplicate requests (e.g., locking or unique constraint)
  • Returning consistent responses for duplicate requests (e.g., same payout ID and status)
  • Integration with payment provider's idempotency features if available
  • Expiration and cleanup of idempotency records to manage storage

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

Q3

How would you handle multiple surge windows that overlap each other in time?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I said merge or stack depending on business rules, then asked which behavior they wanted.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify that 'surge windows' are intervals with start and end times, and overlapping means finding intersections or merging them. Then propose an algorithmic solution like sorting by start time and merging intervals, while discussing trade-offs such as time/space complexity and real-time constraints.

Pro tip: Mention that in production systems like DoorDash, surge windows might be dynamic and require efficient updates, so consider data structures like interval trees or segment trees for frequent queries. Also, discuss how to handle edge cases like zero-length windows or adjacent intervals.

1. Clarify the problem

Ask questions to understand what 'handle' means: detect overlaps, merge them, or compute something like total surge duration? Confirm input format and constraints.

2. Choose an algorithm

Propose sorting intervals by start time and then merging overlapping ones in a single pass. Explain why this is efficient (O(n log n) time).

3. Discuss trade-offs

Compare with alternative approaches like using an interval tree for dynamic updates, and discuss time/space complexity, scalability, and real-time requirements.

4. Handle edge cases

Mention edge cases: intervals that touch at endpoints, zero-length intervals, large input sizes, and concurrency if updates happen in real-time.

5. Apply to DoorDash context

Relate to DoorDash: surge windows might represent peak delivery times; overlapping windows could mean higher demand, so merging helps in resource allocation or pricing.

Key Points to Mention

  • Sorting intervals by start time and merging overlapping ones (classic merge intervals algorithm).
  • Time complexity: O(n log n) due to sorting, O(n) for merging; space complexity O(n) for output.
  • Alternative data structures: interval trees or segment trees for dynamic scenarios with frequent insertions/queries.
  • Edge cases: adjacent intervals (end == start), zero-length intervals, and intervals that fully contain others.
  • Real-world application: in DoorDash, overlapping surge windows might indicate compounded demand, affecting delivery estimates or pricing.
  • Trade-offs: simplicity vs. efficiency for dynamic updates; batch processing vs. real-time streaming.

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

Q4

How would the algorithm change if the business wants to pay drivers based on the union of their active delivery time rather than computing each delivery independently?

Algorithms & Data StructuresSystem Design
Author's notes

This one was actually interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify the problem: paying based on the union of active delivery time means we need to merge overlapping time intervals across deliveries and sum the total unique time. Then, outline an algorithm that collects all active intervals, sorts them, and merges overlaps to compute the union length, contrasting it with the independent sum approach.

Pro tip: Mention that this is essentially the classic 'merge intervals' problem, and highlight the importance of handling edge cases like zero-length intervals and timezone consistency, which shows attention to real-world data issues.

1. Clarify requirements and assumptions

Confirm that 'active delivery time' refers to periods when the driver is actively working on a delivery, and that the union means non-overlapping total time. Ask about data granularity (e.g., timestamps) and whether intervals can be adjacent or overlapping.

2. Model as interval union problem

Represent each delivery as a time interval [start, end]. The goal is to compute the total length of the union of these intervals, which may overlap if the driver handles multiple deliveries simultaneously.

3. Design algorithm to merge intervals

Sort intervals by start time, then iterate and merge overlapping intervals by updating the end time to the maximum of current end and next end. Accumulate the length of merged intervals.

4. Analyze complexity and compare to independent approach

The algorithm runs in O(n log n) due to sorting, with O(n) space for merged intervals. In contrast, independent computation is O(n) but overcounts overlapping time, so the union approach is more accurate but slightly more complex.

5. Discuss edge cases and practical considerations

Address zero-length intervals, intervals that touch but don't overlap, timezone normalization, and potential need for real-time or streaming updates if data arrives continuously.

Key Points to Mention

  • Interval merging algorithm (sort by start, merge overlaps)
  • Time complexity: O(n log n) vs O(n) for independent sum
  • Handling overlapping deliveries (e.g., batched orders)
  • Edge cases: zero-length intervals, adjacent intervals, timezone consistency
  • Potential for streaming/online algorithm if data is unbounded
  • Impact on payment calculation and fairness

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