← DoorDash Interview Insights

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
Jul 2026

Summary

DoorDash coding screen for a software engineering role. One problem, delivery event processing, and it was more involved than it looked at first glance.

Questions Asked (1)

Q1

You're given a list of delivery event records for a single dasher, each with an order ID, an event type (one of CREATED, ACCEPTED, PICKED_UP, DELIVERED, or CANCELED), and a timestamp string that may include timezone info and may not be sorted. Compute the dasher's total pay given a rate per minute, where an order is active from ACCEPTED until DELIVERED or CANCELED, rounding down to whole minutes. Handle malformed sequences explicitly.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The problem sounds like a simple loop until you realize the timestamps aren't sorted and might have timezone offsets.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and edge cases, then outline a solution that groups events by order ID, sorts them by timestamp, and validates the sequence of events. Compute active time per order by pairing ACCEPTED with DELIVERED or CANCELED, rounding down to whole minutes, and sum across orders. Discuss trade-offs between sorting all events globally versus per order, and how to handle malformed sequences.

Pro tip: Explicitly state your assumptions about malformed sequences (e.g., missing ACCEPTED, duplicate events, out-of-order timestamps) and propose a deterministic policy, such as ignoring incomplete orders or logging errors. This shows you think about robustness and production readiness.

1. Clarify requirements and edge cases

Ask about timezone handling, rounding rules, and what constitutes a malformed sequence. Confirm whether to ignore or error on malformed orders, and whether multiple ACCEPTED events per order are possible.

2. Group and sort events per order

Use a hash map to group events by order ID, then sort each order's events by timestamp. Parse timestamps into a comparable format (e.g., epoch milliseconds) handling timezone offsets.

3. Validate event sequences

For each order, check that events follow the expected order: CREATED (optional), ACCEPTED, then PICKED_UP (optional), then DELIVERED or CANCELED. Flag orders with missing or out-of-order events as malformed.

4. Compute active duration per order

For valid orders, find the ACCEPTED timestamp and the subsequent DELIVERED or CANCELED timestamp. Compute the difference in minutes, round down to whole minutes, and accumulate total pay.

5. Handle malformed sequences and summarize

Decide on a policy for malformed orders (e.g., skip, count as zero, or throw error) and explain it. Return total pay and optionally report malformed orders for debugging.

Key Points to Mention

  • Timestamp parsing with timezone awareness (e.g., using ISO 8601 and converting to UTC).
  • Sorting events per order to ensure correct sequence, considering O(n log n) time complexity.
  • Validation of event sequences: required ACCEPTED and terminal event (DELIVERED or CANCELED).
  • Rounding down to whole minutes using integer division or floor function.
  • Handling malformed sequences: missing events, duplicates, out-of-order timestamps, and multiple terminal events.
  • Trade-offs between strict validation (fail fast) and lenient processing (skip malformed orders) for production systems.

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