FastPrepMeeting Room
Problems/Meeting Room

Meeting Room

WeWork logoWeWork● MediumFULLTIMEOA

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

An office has one meeting room, and N groups want to use it. Group i has people[i] people. It wants the room from time starting[i] to time ending[i], and both of those times count.

Two groups cannot be in the room at the same time. A group can use the room after another group only if the first group's end time is less than the second group's start time. A group either gets the room for its whole time or does not use it at all. If a group does not get the room, none of its people can meet.

Choose which groups get the room so that as few people as possible cannot meet. Return that smallest number of people.

For example, with people = [4, 3, 5, 6, 10], starting = [1, 2, 3, 6, 5] and ending = [1, 2, 5, 7, 7], the last group (10 people) overlaps two others that hold 11 people together, so it is best to skip the last group only. The answer is 10.

Complete the function minPeopleCannotMeet in the editor.

minPeopleCannotMeet has the following parameters:

  • int[] people: the number of people in each group
  • int[] starting: the start time of each group's meeting
  • int[] ending: the end time of each group's meeting

The function returns an int: the smallest number of people who cannot meet. Here N is the length of the three arrays.

Function

minPeopleCannotMeet(people: int[], starting: int[], ending: int[]) → int

Examples

Example 1

people = [4, 3, 5, 6, 10]starting = [1, 2, 3, 6, 5]ending = [1, 2, 5, 7, 7]return = 10

Group 1 (4 people) uses the room at time 1. Group 2 (3 people) uses it at time 2. Group 3 (5 people) uses it from time 3 to 5. Group 4 (6 people) uses it from time 6 to 7.

Group 5 (10 people) wants time 5 to 7. That overlaps group 3 at time 5 and group 4 at times 6 and 7, so it cannot use the room. Giving the room to group 5 instead would take it away from groups 3 and 4, which hold 11 people, so that is worse.

Only group 5 cannot meet, so the answer is 10.

Constraints

  • 1 ≤ N ≤ 105, where N is the length of people, starting and ending
  • 1 ≤ people[i] ≤ 104
  • 1 ≤ starting[i] ≤ ending[i] ≤ 109

More WeWork interview questions

  • Shopping and BillingOA · Seen Mar 2024

Similar questions at other companies

  • Maximum Compatible Time WindowsIBM · OAIBM interview questions
  • Task SchedulingJP Morgan Chase · OAJP Morgan Chase interview questions
  • Minimum Markers to Clear Line SegmentsHSBC · OAHSBC interview questions
  • Minimum Machines for TasksExpedia · OAExpedia interview questions
  • Minimum SegmentsSnowflake · OASnowflake interview questions
  • Meetup Schedule 📆WeRide · OAWeRide interview questions
  • Most Disjoint Intervals From Starts and DurationsDocuSign · OADocuSign interview questions
  • University Career FairRoblox · OARoblox interview questions
  • Minimum RetailersAmazon · OA
  • Calculate Minimum Satellites RequiredGoogle · OAGoogle interview questions
All WeWork interview questionsSee WeWork hiring insights
Saved
class Solution {
    public int minPeopleCannotMeet(int[] people, int[] starting, int[] ending) {
      // write your code here
    }

}
Checking account…