Tap here to switch tabs
Problem
Submissions

Problem: Meeting Scheduler

med
30 min
Try to solve the Meeting Scheduler problem.

Statement

You are given two lists of availability time intervals, slots1 and slots2, where each interval is represented as [start, end]. You are also given an integer duration representing the required length of a meeting.

Return the earliest time interval [meetingStart, meetingEnd] such that:
the meeting fits entirely within an interval from slots1 and within an interval from slots2, and meetingEnd - meetingStart = duration.

If no such time interval exists, return an empty list.

Constraints:

  • 1≤1 \leq slots1.length, slots2.length ≤104\leq 10^4

  • slots1[i].length == 22 and slots2[i].length == 22

  • slots1[i][0] << slots1[i][1]

  • slots2[i][0] << slots2[i][1]

  • 0≤0 \leq slots1[i][j], slots2[i][j] ≤109\leq 10^9

  • 1≤1 \leq duration ≤106\leq 10^6

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Meeting Scheduler

med
30 min
Try to solve the Meeting Scheduler problem.

Statement

You are given two lists of availability time intervals, slots1 and slots2, where each interval is represented as [start, end]. You are also given an integer duration representing the required length of a meeting.

Return the earliest time interval [meetingStart, meetingEnd] such that:
the meeting fits entirely within an interval from slots1 and within an interval from slots2, and meetingEnd - meetingStart = duration.

If no such time interval exists, return an empty list.

Constraints:

  • 1≤1 \leq slots1.length, slots2.length ≤104\leq 10^4

  • slots1[i].length == 22 and slots2[i].length == 22

  • slots1[i][0] << slots1[i][1]

  • slots2[i][0] << slots2[i][1]

  • 0≤0 \leq slots1[i][j], slots2[i][j] ≤109\leq 10^9

  • 1≤1 \leq duration ≤106\leq 10^6