Just had an onsite with Bloomberg and did not move to the next rounds.
Round 1 :
The interviewer wanted me to code in C++ but I said I am a python developer and I coded in python
Follow up : What is the tree did not contain any of the nodes.
Design and implement a module that provides a simple web browser history functionality. The module should be capable of capturing and providing the web URLs visited in chronological order (most recently visited first). Each URL should be listed only once.
Example of inputs is to visit
http://www.bloomberg.com,
then visit http://www.bbc.com,
then visit http://www.cnn.com
then visit http://www.bbc.com again.
The expected output for this case is:
http://www.bbc.com
http://www.cnn.com
http://www.bloomberg.com
Round 2:
int StockTradeOrder::finishSettlement() {
...
// The object won't be used again after this method.
delete this;
return 0;
}Again I told them I am not a C++ developer but a python developer.
Discussed all the approaches. Not sure why some interviewers are so impatient.
You know when there are two interviewers, I cannot talk to both of you at the same time. I was answering a question of one interviewer and the other one kept jumping in.
I wrote a program and there were mistakes and i was trying to trace it and ofc I would have found it when i traced, this guy SSE was so over enthusiastic to correct me. Sorry I cannot do two things at once.
The class definition below stores apps currently available in the store as well as some metadata about the publishers of these apps. We want to add the following two new functions in AppStoreDataService class:
replacePublisherName(): ability to change name of a given publisher
getAppsByPublisher(): get list of apps for a given publisher.
You can change internal data-structure and design in any way you want, but keep the current functionality intact. There are millions of apps published by millions of publishers and any linear search across this data is very expensive. At the same time, the current system is already running high in memory usage. We need to keep runtime complexity and memory usage in mind with the new improved design.
Physical Materials
Following class currently supports functionality of an AppStore:
class AppStoreEntry
{
public:
string _appId; // Unique for each app
string _appName;
string _category;
string _publisherId; // Unique for each publisher
string _publisherName;
};
class AppStoreDataService
{
private:
std::unordered_map<string, AppStoreEntry> _data; // Apps in the store
public:
// Existing Functionality
addNewApp(const AppStoreEntry& data);
removeApp(const string& appId);
getAppName(const string& appId, string& appName);
string getPublisherName(const string& publisherId); // Tries to find publisher by iterating all apps
// New functionality to be implemented (part of question)
//void replacePublisherName(const string& publisherId, const string& newName);
//void getAppsByPublisher(const string& publisherId, vector<string>& outAppNames);
};
string AppStoreDataService::getPublisherName(const string& publisherId)
{
std::unordered_map<string, AppStoreEntry>::iterator it;
for(it=_data.begin(); it!=_data.end(); ++it)
{
if(it->second._publisherId == publisherId) return it->second._publisherName;
}
throw std::invalid_argument("Bad publisher id: "+publisherId); // In case we don't have
}
Again this is a C++ code and I am a Python developer.
Last thoughts :