Problem · Intervals
Get Meeting Intervals (Google Bangalore)
Learn this problemProblem statement
Return a list of non-overlapping time intervals when you are in a meeting.
Function
getMeetingIntervals(meetings: int[][], dns: int[]) → int[][]
Complete the function getMeetingIntervals in the editor.
getMeetingIntervals has the following parameters:
- 1.
int[][] meetings: an arr of intervals representing meeting times - 2.
Interval dns: an interval representing the "Do Not Schedule" time
Returns
int[][]: an arr of non-overlapping intervals when you are in a meeting
Examples
Example 1
meetings = [[1, 7], [5, 10], [12, 30], [22, 30], [40, 50], [60, 70]]dns = [18, 25]return = [[1, 10], [12, 18], [25, 30], [40, 50], [60, 70]]🦔
Constraints
0 ≤ meetings.length ≤ 2 * 10^5- Every interval is half-open: it includes its start and excludes its end.
- For every meeting
[start, end]and fordns = [dnsStart, dnsEnd], the start is strictly less than the end. - Interval endpoints are integers in
[-10^9, 10^9]. - Return the resulting non-overlapping intervals in increasing start-time order.