← DoorDash Interview Insights

DoorDash·Software Engineer·Technical Phone Screen·Intermediate

Intermediate
May 2026

Summary

DoorDash coding screen, one problem the whole time. It's a scheduling/time-slot encoding question that looks deceptively simple until you actually have to handle AM/PM, 24-hour conversion, and day rollover all at once.

Questions Asked (1)

Q1

Given a list of start times in 'Day HH:MM AM/PM' format and a corresponding end time, generate all 5-minute interval slot codes between them. Each code is a 5-digit integer where the first digit is the day of the week (1=Mon through 7=Sun) and the remaining four digits are the hour and minute in 24-hour format. Handle AM/PM conversion, correct 24-hour formatting, and day rollover when the interval crosses midnight.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

I underestimated this.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Clarify the input format and edge cases (e.g., day rollover, AM/PM conversion) before coding. Then outline a step-by-step algorithm: parse times, convert to minutes since start of week, iterate in 5-minute increments, and format each slot code. Discuss trade-offs between iterative and mathematical approaches, and mention testing strategies.

Pro tip: Mention that you would write unit tests for edge cases like midnight rollover, 12 AM/PM conversion, and intervals spanning multiple days. This shows attention to detail and production readiness.

1. Clarify requirements and edge cases

Ask about input format, expected output, and how to handle day rollover, invalid times, and intervals that cross multiple days. Confirm whether the end time is inclusive or exclusive.

2. Parse and normalize times

Convert start and end times to a common unit, such as minutes since the start of the week (Monday 00:00). Extract day of week, hour, and minute, and handle AM/PM conversion (12 AM = 00, 12 PM = 12).

3. Generate intervals

Iterate from start to end in 5-minute increments, handling day rollover by taking modulo 7 for day and modulo 24 for hour. For each interval, compute the 5-digit code.

4. Format and output

Format each code as a 5-digit integer: day (1-7) followed by two-digit hour (00-23) and two-digit minute (00-59). Ensure leading zeros are preserved.

5. Test and validate

Test with edge cases: intervals crossing midnight, spanning multiple days, starting/ending at 12 AM/PM, and intervals not aligned to 5-minute boundaries. Discuss time and space complexity.

Key Points to Mention

  • Time parsing and conversion to a common unit (e.g., minutes since start of week) to simplify arithmetic.
  • Handling AM/PM correctly, especially 12 AM and 12 PM.
  • Day rollover logic: when hour reaches 24, increment day and reset hour to 0; when day exceeds 7, wrap to 1.
  • Formatting with leading zeros for hour and minute to ensure 5-digit code.
  • Edge cases: intervals crossing midnight, multiple days, and non-5-minute-aligned start/end times.
  • Trade-offs: iterative vs. mathematical generation, and potential optimizations for large intervals.

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