Create a ServerManager class with the functions allocate(string) and deallocate(string) to the following specifications: allocate('apibox') = 'apibox1' allocate('apibox') = 'apibox2' allocate('sitebox') = 'sitebox1' allocate('apibox') = 'apibox3' deallocate('apibox2') allocate('apibox') = 'apibox2'
Anonymous
Use a map> where the key is the string you are allocating, and the value if a vector of allocations of that string. O(1) for insertion in all cases, O(1) for reading/deleting
Check out your Company Bowl for anonymous work chats.