Hello, so I just had my Bloomberg interview few days ago.
The 1st round: Phone Call
It was pretty easy got asked 2 questions, one similar to LRU cache
2nd one similiar to Two sum find array pairs that add up to target value
I was able to solve both and moved forward to the video interview
2nd Round: Video Interview
2 interviewees, started off with behavioural questions like why bloomberg and so on.
The coding questions,
*Given a Subway system where the customer can swipe in his card to check in and swipe out his card to check out at destination station, get the average time needed to travel between any 2 stations. and I should save customer Id, create swipeIn and swipeOut functions and another to get the average
My main problem was that the interviewer didnt write the question or even a part of it, he just read it out loud really fast and ofcourse its a video call the connection isnt 100% so this for me ruined everything.
While he was reading the question I was trying to write on hackerrank shared screen what the question is and i asked a lot of question to understand what he wants but it made nervous already that it wasnt clear, the question isnt hard its complex for us internationals to understand it on the spot while listening.
Anyways, I did something like that (sudo code below: Excuse me if I forgot "self.")
def __init__(self):
self.myDict=defaulttdict(list)
self.time=0
self.myStation=defaulttdict(list)
def swipeIn(InTime,arrSt,custId):
self.time=InTime
selfmyDict[custId].append(arrSt)
def swipeOut(OutTime,DestSt,custId):
TotalTime=OutTime-self.Time
myDict[custID].append(DestSt)
myDict[custID].append(TotalTime))
val=myDict[custID]
route=val[0]+val[1] #arrivalSt+desSt
if Route in self.myStation:
v=self.myStation[Route]
v[0]+=TotalTime #store all totalTime
v[1]+=1 #store number if passengers
v[2]=v[0]/v[1] #to store the average
else:
v=[0,0,0]
v[0]=TotalTime #store all totalTime
v[1]=1 #store number if passengers
v[2]=v[0]/v[1] #to store the average
myStation[route]=v
def GetAverage(dest,arr):
route=dest+arr
if route in myStation:
v=myStation[route]
return v[2]
return -1 I told him that I can sort route to get the same value for station AB=BA, but he told me its find he'd consider them differnt routes
Other Questions which I didnt do well in:
how does python store dictionaries? what key types are ok in python (I told him i only used strings and integers)
Follow up Question
1.what if a person lost his card how can you utilize that fact?
Ans: I told him I wouldnt store his custID anymore so I can use an orderdict with any capacity I want for example 500K persons and if i get a new person I remove the oldest entry from my OrderedDict
I know that overall I didnt do great, yet I got bumped from the rejection, I think things wouldve been better if he wrote down the questions and I should definitely study a thing or two on how things work with python internally