Tesla OA Interview Question: Meeting Rooms (Can Attend All Meetings Without Overlap?)

18 Views
No Comments

Given an array of meeting time intervals consisting of start and end times [s1, e1], [s2, e2], …, determine if a person could attend all meetings without overlap.

Input:

An array of meeting intervals where each interval is represented as [start, end].

Example 1:

meetings = [[0, 30], [5, 10], [15, 20]]

Output:

false

Because the person has overlapping meetings (for example, [0, 30] and [5, 10] overlap).

This problem asks whether any meeting intervals overlap. The standard solution is to sort the meetings by start time and then scan through them, checking whether the current meeting starts before the previous one ends. If that happens, the schedule is impossible; otherwise, all meetings can be attended. The approach is simple, efficient, and runs in O(n log n) time due to sorting.

END
 0