I got this Question during amazon onsite interview. Can someone give me code for this.
You work for a company with more than a million employees when a pandemic hit.
The virus is likely spread when people are together in a room.
You need to create a system that can do contact tracing so that the company can warn employees to stay home if they were exposed.
You have records of when someone entered and exit a room in the following format:
time (int), username (string), room (string), enter/exit
For example:
0, hyobyun, meetingRoomA, enter
5, jeff, meetingRoomA, enter
10, hyobyun, meetingRoomA, exit
15, jeff, meetingRoomA, exit
...
Given a username of someone who had the disease, list out the usernames of everyone who stay