Round 1
Questions:
Find the earliest time at which the maximum number of clients are interacting with the server.
Given 2 list inputs of equal length (for example: start = [2,4,7,8,9], end = [1,5,9,14,54]), output the earliest time at which the most users would be online. (i.e. output 7).
Candidate's Approach
I wasn't able to finish it in time as my first solution had a high time complexity. If I could have gone back I would have wrote something like:
allTimes = sort([(hour,1) for hour in start] + [(hour,-1) for hour in end], key = lambda x : x[0]) d = {} online = 0 for time in allTimes: online += time[1] d[time[0]] = online return max(d, key=d.get)
Interviewer's Feedback
No feedback provided.