Skip to main content
All Questions

Design a restaurant waitlist API and data structure.

Unlock detailed company stats for this questionUpgrade

Requirements:

  1. A group of customers can join the waitlist (with a reasonable limit of n people).
  2. A party that has joined the waitlist can leave at any time.
  3. When a table becomes free, serve the first party on the waitlist that fits the available size (e.g., a party of 4 can take a table of 6 if they are first in the waitlist, but a party of 8 doesn't fit a table of size 6).
  4. Given a list of incoming groups, where each entry has a time, group size and group id, return the time at which each group was given a table.
  5. Follow-up: find the ids of the people currently sitting in the restaurant.

Community answers

No answers contributed by the community yet.

Related courses

Course

Software Engineering Interview Prep

Land your dream software engineering role at Google, Amazon, Microsoft, Meta, Apple, and other top companies. Learn from mock interviews, frameworks, and advice from senior candidates—practice data structures, algorithms, system design, people management, behavioral interviews, and more.

Course

System Design Interviews

Learn how to answer the latest system design questions across product, infrastructure, and AI domains. Features in-depth video examples, written breakdowns, and helpful reference patterns. Watch senior engineers and managers answer these questions in mock interview videos.