Note - the original problem description is in the problem source section below 👇👇
Imagine you’re in charge of scheduling a new meeting for a group of employees who have already packed their day with various appointments. The day is measured in minutes, starting from 0 (midnight) and ending at 1440 minutes (the very last moment of the day). Each employee’s busy schedule is laid out in a special array called schedules.
In this array:
You’ve been tasked with finding the earliest moment in this busy day where all employees are free to meet for a certain period of time, called length. But, there’s a catch! The new meeting needs to fit within the same day, meaning it can’t run past 1440 minutes (the end of the day).
Your job is to sift through the employees’ schedules, find a time where everyone is available for this new meeting, and figure out the earliest possible time to set it. If there’s no such moment when all are free for that meeting, you’ll return -1, indicating that it’s impossible to schedule the meeting on this day.
Don’t worry too much about finding the absolute most efficient solution—just make sure that your approach can handle the complexity of multiple busy schedules without taking too long.
Example 1:
Input: schedules = [[[60, 150], [180, 240]], [[0, 210], [360, 420]]], length = 120
Output: 240
Explanation:see problem source below for details.
Example 2:
Input: schedules = [[[480, 510]], [[240, 330]], [[375, 400]]], length = 180
Output: 0
Explanation:see problem source below for details. you are the best!
1 <= schedules.length <= 100
0 <= schedules[i].length <= 100
schedules[i][j].length = 2
0 <= schedules[i][j][0] < schedules[i][j][1] <= 1400
1 <= length <= 24 * 60


input:
output: