← DoorDash Interview Insights

DoorDash·Software Engineer·Onsite - System Design / Architecture·Senior

SeniorPrefer not to say
May 2026

Summary

DoorDash system design round that was basically one big question about building an image carousel with comments, voting, and efficient data structures. More depth than I expected for a single problem.

Questions Asked (4)

Q1

Design an image carousel that supports forward/backward cycling and autoplay with a configurable interval. Walk through the data structures, APIs, and time/space complexity.

System DesignAlgorithms & Data Structures
Author's notes

The carousel mechanics themselves weren't the hard part.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (e.g., circular vs. bounded, autoplay behavior, UI framework) and then design a clean API that separates state management from rendering. Use a circular buffer or doubly linked list for O(1) navigation, and a timer for autoplay with pause/resume. Analyze time/space complexity for each operation and discuss trade-offs.

Pro tip: Mention that autoplay should pause on user interaction (hover/focus) and resume after a delay—this shows attention to UX and real-world edge cases. Also, consider using requestAnimationFrame for smooth transitions instead of setInterval for better performance.

1. Clarify Requirements and Constraints

Ask about the environment (web, mobile), expected features (infinite loop, indicators, touch support), and performance constraints. Confirm if autoplay should pause on interaction and if the interval is configurable at runtime.

2. Design Data Structures

Choose a data structure for storing images and current index. A circular buffer (array with modulo) or doubly linked list gives O(1) next/prev. For autoplay, use a timer ID and a boolean flag for playing state.

3. Define APIs and Methods

Outline public methods: next(), prev(), goTo(index), play(), pause(), setInterval(ms). Include event callbacks for slide change and autoplay state. Ensure methods handle edge cases (e.g., empty list, single image).

4. Analyze Time and Space Complexity

Navigation is O(1) time, O(n) space for storing images. Autoplay uses O(1) additional space for timer. Discuss trade-offs: array vs. linked list (cache locality vs. dynamic size).

5. Discuss Edge Cases and Optimizations

Address rapid clicking, timer drift, memory leaks (clear timers on destroy), and accessibility (keyboard navigation, ARIA). Suggest optimizations like lazy loading images and using CSS transitions.

Key Points to Mention

  • Circular buffer or modulo arithmetic for O(1) forward/backward cycling
  • Timer management with setInterval/setTimeout and clearing on pause/destroy to avoid memory leaks
  • Pause autoplay on user interaction (hover, focus, touch) and resume after a delay
  • Use of requestAnimationFrame for smooth transitions and better performance
  • API design: next(), prev(), goTo(index), play(), pause(), setInterval(ms), and event callbacks
  • Time complexity: O(1) for navigation, O(n) space for storing images; autoplay O(1) extra space

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

Q2

Design a per-image comment thread with full create, read, edit, and delete support. What APIs do you expose, including pagination?

System DesignAPI & IntegrationsData Modeling
Author's notes

I went with cursor-based pagination pretty confidently since offset pagination breaks when comments get deleted mid-session.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements (e.g., comment nesting, edit history, moderation) and then outline the data model and API endpoints. Focus on RESTful design with cursor-based pagination for scalability, and discuss trade-offs for edit/delete semantics.

Pro tip: Mention soft deletes and edit history to handle audit and moderation needs, and use cursor-based pagination with a stable sort order to avoid duplicates or missing items during concurrent updates.

1. Clarify Requirements

Ask about comment threading (flat vs nested), edit/delete permissions, and expected scale to tailor the design.

2. Design Data Model

Define entities like Comment with fields: id, image_id, user_id, content, created_at, updated_at, parent_id (for replies), and is_deleted flag.

3. Define API Endpoints

List CRUD endpoints: POST /images/{image_id}/comments, GET /images/{image_id}/comments, PATCH /comments/{comment_id}, DELETE /comments/{comment_id}.

4. Implement Pagination

Use cursor-based pagination with parameters like limit and cursor (e.g., last comment ID or timestamp) to efficiently fetch comments in order.

5. Discuss Trade-offs

Address soft vs hard deletes, edit history, rate limiting, and consistency models to show depth.

Key Points to Mention

  • Cursor-based pagination using a stable sort key (e.g., created_at + id) to handle real-time updates.
  • Soft deletes (is_deleted flag) to preserve thread structure and enable moderation/audit.
  • Edit history tracking (e.g., separate table or version field) for transparency and compliance.
  • Authorization checks: ensure users can only edit/delete their own comments (or admins).
  • Rate limiting and spam prevention for comment creation.
  • Nested comments support via parent_id and recursive fetching or materialized paths.

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

Q3

Support upvoting and downvoting on comments and return the top-k comments per image ordered by score, with ties broken by recency. Design the data structures for this at scale (up to 100k images and 1 million comments).

Algorithms & Data StructuresSystem DesignTechnical Trade-offs
Author's notes

This is where I spent most of my time and also where I felt shakiest.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

Start by clarifying requirements and scale, then propose a data model that separates vote storage from comment metadata to handle high write throughput. For top-k retrieval, use a combination of per-image heaps or sorted sets with lazy updates, and discuss trade-offs between real-time and batch processing.

Pro tip: Mention that you would use a write-optimized store for votes (e.g., Cassandra) and a read-optimized cache (e.g., Redis sorted sets) for top-k, and that you would handle ties by including timestamp in the sort key. This shows you think about both write and read paths at scale.

1. Clarify Requirements and Scale

Ask about read/write patterns, latency requirements, consistency needs, and whether votes can be changed or removed. Confirm the scale: 100k images, 1M comments, and potentially many votes per comment.

2. Design Data Model for Votes and Comments

Propose separate storage for votes (e.g., a wide-column store keyed by comment_id) and comments (e.g., a relational or document store). Include fields like comment_id, image_id, score, created_at, and upvote/downvote counts.

3. Design Top-K Retrieval Strategy

For each image, maintain a sorted set (e.g., Redis ZSET) of comment_ids scored by (score, timestamp). Use a heap or sorted set to efficiently retrieve top-k. Discuss how to update the set on vote changes.

4. Address Scalability and Trade-offs

Discuss sharding by image_id, caching top-k results, and handling hot images. Compare real-time updates vs. batch recomputation, and explain how to handle ties and vote changes.

5. Summarize and Discuss Extensions

Wrap up with a coherent design, mention potential bottlenecks, and suggest extensions like pagination, time-decay scoring, or anti-abuse measures.

Key Points to Mention

  • Use of composite score (score, timestamp) to break ties by recency.
  • Sharding by image_id to distribute load across nodes.
  • Caching top-k results in Redis or a similar in-memory store for low-latency reads.
  • Handling vote changes and deletions with idempotent updates or event sourcing.
  • Trade-offs between strong consistency and eventual consistency for vote counts.
  • Consideration of hot images and how to mitigate hotspots (e.g., replication, local caching).

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

Q4

How do you prevent double-counting when a user rapidly toggles votes on a comment?

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 clarifying the requirements and constraints, then propose a layered solution combining client-side debouncing, idempotent server operations, and database-level constraints. Discuss trade-offs between consistency, latency, and complexity, and how you would handle edge cases like network retries.

Pro tip: Emphasize idempotency keys and atomic database operations as the core defense, and mention that client-side throttling alone is insufficient because users can bypass it or have multiple devices.

1. Clarify Requirements and Constraints

Ask about expected scale, consistency requirements, and whether the vote count needs to be exact in real-time. This shows you understand the problem context before jumping to solutions.

2. Client-Side Mitigation

Propose debouncing or throttling UI events to reduce the number of requests sent. Acknowledge this is a first line of defense but not sufficient alone.

3. Idempotent API Design

Design the vote endpoint to be idempotent using a unique request ID or idempotency key. The server should recognize duplicate requests and return the same response without applying the vote twice.

4. Atomic Database Operations

Use database transactions with conditional updates (e.g., INSERT ... ON CONFLICT DO NOTHING) or unique constraints on (user_id, comment_id) to ensure a user can only vote once. This prevents double-counting even if requests slip through.

5. Handle Edge Cases and Trade-offs

Discuss network retries, distributed systems (e.g., using a distributed lock or consensus), and the trade-off between strong consistency and availability. Mention monitoring and alerting for anomalies.

Key Points to Mention

  • Idempotency keys to deduplicate requests
  • Database unique constraints or conditional writes
  • Client-side debouncing/throttling
  • Atomic transactions and isolation levels
  • Handling retries and network failures
  • Trade-offs between consistency, latency, and complexity

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