Google | Phone Screen
Anonymous User
5240
Design a data structure to perform three operations (Restaurant is full initially):
1) waitList (int group_size, int table_size):
Add the group and table size they want to book into the waitlist
2) leave (int group_size):
Group wants to leave the waitlist so remove them.
3) serve (int table_size):
This means restaurant now has a free table of size equal to table_size. Find the group whose required size is less than or equal to the table_size. If multiple customers are matching use first come first serve. to serve from waitlist

	I solved it using deque.
Comments (12)