Uber India interview question
Difficulty: MEDIUMCategory: InterviewExperienceFrequency: 1Asked On 2023-01-27Added By Anonymous
Source: Link
Company: Uber
Role: unknown
Interview Stage: Phone Screen
Location: India
Year: unknown
Original Post Content:
Consolidate Security Guard Shifts
A list of individual security guard shifts will be provided as input in the format [tStart, tEnd, name].
Return a consolidated list in such a way that no timestamp is overlapped.
-----------------------------------------------------------
Input
----------------------------------------------------------
1 - 10 | S 1
1 - 15 | S 2
1 - 13 | S 5
3 - 7 | S 3
12 - 15 | S 4
--------------------------------
Output
--------------------------------
1 - 3 | S 1, S 2, S 5
3 - 7 | S 1, S 2, S 5, S 3
7 - 10 | S 1, S 2, S 5
10 - 12 | S 5, S 2
12 - 13 | S 5, S 2, S 4
13 - 15 | S 4, S 2