Problem ¡ Intervals

Schedule Meeting

● MediumRobloxINTERNOA
See Roblox hiring insights

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:

  • schedules[i][j] tells you the exact start and end times of the jth meeting for the ith employee.
  • Every meeting is represented as a pair of numbers: [startTime, finishTime]—both in minutes since the start of the day.
  • 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.

    Examples
    01 ¡ Example 1
    schedules = [[[60, 150], [180, 240]], [[0, 210], [360, 420]]]
    length = 120
    return = 240
    Example 1 illustration
    see problem source below for details.
    02 ¡ Example 2
    schedules = [[[480, 510]], [[240, 330]], [[375, 400]]]
    length = 180
    return = 0
    see problem source below for details. you are the best!
    Constraints
  • 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
  • More Roblox problems
    drafts saved locally
    public int robloxScheduleMeeting(int[][][] schedules, int length) {
      // write your code here
    }
    
    schedules[[[60, 150], [180, 240]], [[0, 210], [360, 420]]]
    length120
    expected240
    sign in to submit