Amazon Onsite Interview Question

Anonymous User
597
Jun 02, 2025

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, Navi, meetingRoomA, enter
5, jeff, meetingRoomA, enter
10, Navi, meetingRoomA, exit
15, jeff, meetingRoomA, exit

Given a username of someone who had the disease,
list out the usernames of everyone who stayed in the same room with them.

Input: Jeff
Outpu: Navi

Comments (6)