Implement image carousel with comments and upvotes

Read the full interview experience this question came from →

Quick Overview

This question evaluates a candidate's ability to design scalable data structures and efficient algorithms for interactive features, including API design, pagination, and consistency/concurrency handling for upvotes and per-image comment threads.

Implement image carousel with comments and upvotes

Company: DoorDash

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Onsite

Implement an image carousel that supports: 1) cycling forward/backward and autoplay with a configurable interval; 2) a per-image comment thread with create/read/edit/delete; 3) upvoting/downvoting comments and returning the top-k comments per image ordered by score, breaking ties by recency. Design the data structures to support add/delete comment, update vote, and query top-k efficiently at scale (up to 10^5 images and 10^6 comments across images). Specify the time/space complexities, the APIs you would expose (including pagination of comments), and how you would prevent double-counting when a user rapidly toggles votes.

Overview: This question evaluates a candidate's ability to design scalable data structures and efficient algorithms for interactive features, including API design, pagination, and consistency/concurrency handling for upvotes and per-image comment threads.

Read the full DoorDash Software Engineer interview experience this question came from

|Home/Coding & Algorithms/DoorDash
DoorDash logo
DoorDash
Sep 6, 2025
mediumSoftware EngineerOnsiteCoding & Algorithms
5
0

Implement an image carousel that supports:

  1. cycling forward/backward and autoplay with a configurable interval;
  2. a per-image comment thread with create/read/edit/delete;
  3. upvoting/downvoting comments and returning the top-k comments per image ordered by score, breaking ties by recency. Design the data structures to support add/delete comment, update vote, and query top-k efficiently at scale (up to 10^5 images and 10^6 comments across images). Specify the time/space complexities, the APIs you would expose (including pagination of comments), and how you would prevent double-counting when a user rapidly toggles votes.

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...