Back to problems

Restaurant Waitlist: join / delete / find_first_match

Object-Oriented Programming · Google · Medium

Requirements Create a class that provides the following operations: join(user) — place user, including their party_size, at the back of the waiting list. delete(user) — take user off the waitlist, even when they are not at the front. find_first_match(table_size: int) — identify the longest-waiting user who remains on the list and has party_size <= table_size. This lookup must leave that user in the waitlist. Implicit constraints Arrival sequence must be respected: among…

Checking your access…