Implement Restaurant Waitlist API
Implement restaurant waitlist API and data structure with the following requirements: 1) A party of customers can join the waitlist (with a reasonable limit of n people). 2) A party which 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 join a table of 6 if they are first in waitlist, but a party of 8 doesn't fit at a table of size 6).
Asked at:
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
Mid June, 2025
Mid-level
Was asked the exact same question.
Early October, 2024
Mid-level
Implement restaurant waitlist API and data structure with the following requirements: 1) A party of customers can join the waitlist (with a reasonable limit of n people). 2) A party which 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 join a table of 6 if they are first in waitlist, but a party of 8 doesn't fit at a table of size 6).
Your account is free and you can post anonymously if you choose.