Panda Guru LogoPanda
Guru

Google L3 | Full Question

Round 2

Questions: Imagine you are responsible for leading a car rental company. You are given a collection of reservation times with the following structure:

struct reservation{ int id; int pickup_time; int return_time; }

Your task is to assign as few cars as possible to the collection of reservations. Furthermore, you are tasked with returning the set of time intervals each respective car was used.

Example Input: Reservations: [[1,4],[2,5],[3,7],[6,9]]

Example Output: car1 -> [{1,4},{6,9}] car2 -> [{2,5}] car3 -> [{3,7}]

Constraints and questions, which I asked:

Candidate's Approach

Provided a sweep line solution to solve this question. The interviewer seemed satisfied and the solution passed my debugging test cases.

Interviewer's Feedback

No feedback provided.