← DoorDash Interview Insights

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

DoorDash software engineering interview with a coding problem themed around their actual delivery driver pay logic. The follow-up added real complexity and the edge case handling portion felt like it mattered more than I expected.

Questions Asked (3)

Q1

You're given a log of delivery driver events for a single day. Each event is a JSON record with an order ID, event type, timestamp, and a base rate per minute. For each order, find the valid start and end event pair and compute pay as duration times base rate. Return the driver's total pay across all orders for the day.

Algorithms & Data StructuresAPI & Integrations
Author's notes

The core problem wasn't hard once I stopped overthinking the JSON structure.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the event types and validity rules, then design a solution that groups events by order ID, sorts by timestamp, and pairs valid start/end events. Compute duration and pay per order, summing to a total, and discuss edge cases like missing pairs or overlapping events.

Pro tip: Mention that you would validate the data and handle invalid or incomplete orders gracefully, as real-world logs often have anomalies. Also, consider using a single pass with a hash map to achieve O(n) time after sorting or if events are already ordered.

1. Clarify requirements and assumptions

Ask about event types (e.g., 'start', 'end'), validity rules (e.g., must start before end, no overlapping), and how to handle incomplete orders. Confirm the output format and whether base rate can vary per event.

2. Design data structures and algorithm

Group events by order ID using a hash map, then sort each group by timestamp. Iterate through sorted events to find valid start/end pairs, compute duration, and accumulate pay.

3. Handle edge cases and validation

Consider missing start/end events, multiple starts/ends, negative durations, and zero or negative base rates. Decide whether to skip invalid orders or raise errors, and document assumptions.

4. Analyze complexity and optimize

Discuss time complexity: O(n log n) due to sorting, or O(n) if events are pre-sorted. Space complexity O(n) for the hash map. Mention potential optimizations like streaming if data is large.

5. Test with examples and verify

Walk through a simple example with a few orders to verify correctness. Test edge cases like an order with only a start event or events out of order.

Key Points to Mention

  • Grouping events by order ID using a hash map
  • Sorting events by timestamp within each order
  • Identifying valid start/end pairs (e.g., first start followed by first end)
  • Computing duration as end timestamp minus start timestamp
  • Multiplying duration by base rate and summing across orders
  • Handling edge cases: missing pairs, multiple events, invalid timestamps

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

Q2

Follow-up: certain time windows are marked as peak periods where pay is doubled. If a driver's paid interval partially overlaps a peak window, split the interval at the peak boundaries and apply the doubled rate only to the overlapping portion. How do you handle this?

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

This is where it got interesting.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the input format and edge cases, then propose an algorithm that splits the paid interval at peak boundaries and sums the pay for each sub-interval with the appropriate rate. Discuss time complexity and potential optimizations, and consider how to handle multiple peak windows efficiently.

Pro tip: Mention that you would pre-sort peak windows and use binary search to find overlapping windows, reducing time complexity from O(n) to O(log n) per query. Also, emphasize the importance of handling edge cases like zero-length intervals and adjacent peak windows.

1. Clarify requirements and edge cases

Ask about input format (e.g., list of peak windows, paid interval), whether peak windows can overlap, and how to handle boundaries (inclusive/exclusive). Confirm that pay is prorated per minute/second.

2. Outline a straightforward solution

Iterate through all peak windows, compute the overlap with the paid interval, and accumulate pay: base rate for non-overlapping parts and double rate for overlapping parts. Use a sweep-line or interval merging if needed.

3. Optimize for multiple queries

If many queries, preprocess peak windows by sorting and merging overlaps, then use binary search to find relevant windows. Compute total pay by summing contributions from each segment.

4. Analyze complexity and trade-offs

Discuss time and space complexity of both approaches. For a single query, O(n) is fine; for many queries, O(log n + k) where k is number of overlapping windows. Mention trade-offs between preprocessing and query time.

5. Test with examples and edge cases

Walk through a concrete example, such as paid interval [1,5] and peak [3,7], showing split at 3 and 5. Test edge cases: no overlap, full overlap, multiple peaks, zero-length intervals.

Key Points to Mention

  • Interval splitting at peak boundaries
  • Calculating overlap between two intervals
  • Handling multiple peak windows efficiently (sorting, merging, binary search)
  • Time complexity analysis (O(n) vs O(log n) per query)
  • Edge cases: zero-length intervals, adjacent peaks, inclusive/exclusive boundaries
  • Prorating pay based on duration (e.g., per minute)

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

Q3

How would you handle malformed input in this system? For example: events with no matching pair, duplicate events for the same order, or events that appear in an invalid order (like a completion before a start).

System DesignTechnical Trade-offs
Author's notes

Felt like a throwaway at first but the interviewer spent a real amount of time on it.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying the system's requirements and the impact of malformed input on downstream consumers. Then propose a layered defense: validation at ingestion, idempotent processing, and dead-letter queues for unprocessable events. Emphasize trade-offs between strict rejection, graceful degradation, and observability.

Pro tip: Mention that you'd log malformed events with enough context for debugging but avoid logging sensitive data. Also, discuss how you'd monitor and alert on malformed input rates to detect upstream issues early.

1. Clarify requirements and impact

Ask about the system's guarantees: is it at-least-once or exactly-once? What are the downstream effects of malformed events? This determines whether to reject, quarantine, or attempt repair.

2. Validate at ingestion

Implement schema validation and business rule checks (e.g., event order, required fields) as early as possible. Reject or route invalid events to a dead-letter queue with metadata.

3. Handle duplicates and ordering

Use idempotency keys (e.g., order ID + event type) to deduplicate. For ordering, use sequence numbers or timestamps with buffering/windowing to reorder or detect out-of-order events.

4. Design for graceful degradation

Decide on fallback behavior: skip, retry, or compensate. For missing pairs, consider timeouts or manual intervention. Ensure the system remains available and consistent.

5. Monitor and iterate

Track metrics on malformed input rates, types, and sources. Alert on anomalies and use insights to improve upstream validation or system resilience.

Key Points to Mention

  • Idempotency and deduplication strategies (e.g., unique event IDs, idempotency keys)
  • Dead-letter queues for unprocessable events with alerting and manual review
  • Event ordering and time windows (e.g., watermarking, sequence numbers)
  • Trade-offs between strict validation (rejecting) vs. lenient processing (repairing)
  • Observability: logging, metrics, and tracing for malformed input
  • Compensation and reconciliation for missing pairs (e.g., timeout-based pairing)

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