Google London L3 Phonescreen
Anonymous User
1662
#include <bits/stdc++.h>
using namespace std;

/*
    Google L3 London
design a restaurant waitlist reservation system which should support these
1- any group of some size can join the waitlist
2- any group can leave the waitlist at any point of time
3- restaurant can pick any group whenever a table is free and a seat size will be passed as a parameter

I was supposed to figure out the functions, parameters required, and all other requirements myself (for ex the priority of a seat
assigned to a group will be done on a FCFS basis). the skeleton code below is how i coded the solution
*/

class group
{
    string groupName;
    int groupSize;
};

class waitlistSystem
{
    // a map storing key-> groupsize and value-> all possible groups in queue with that size
    unordered_map<int, queue<group>> waitlist;

    // O(1) add group to the specific group size and bucket
    void addWaitlist(group g)
    {
    }

    // O(N) remove the group from the queue and insert back all others
    void removeFromWaitlist(group g)
    {
    }

    // O(1) pop the front element of the queue from the seatsize bucket and assign seat to it
    group assignSeats(int seatSize)
    {
    }
};
Comments (7)