FastPrepMeeting Rooms III: Most Booked Room

Meeting Rooms III: Most Booked Room

Google logoGoogle● HardFULLTIMEONSITE INTERVIEW

Problem statement

You are given an integer n. There are n meeting rooms numbered from 0 to n - 1.

You are also given a 2D integer array meetings, where meetings[i] = [start, end] means a meeting is scheduled for the half-open time interval [start, end). All start values are different.

Meetings are given rooms by these rules:

The problem statement continues
Pro

Examples

Example 1

n = 3meetings = [[0,30],[1,4],[2,5],[3,6],[7,9]]return = 1
  • Meeting [0,30] takes room 0, [1,4] takes room 1, and [2,5] takes room 2.
  • At time 3 every room is busy, so [3,6] waits. Room 1 frees up first, at time 4, so the meeting runs in room 1 during [4,7).
  • At time 7, rooms 1 and 2 are both unused. Meeting [7,9] takes the lower number, room 1.
  • Room 1 held 3 meetings, while rooms 0 and 2 held 1 each.
FastPrep Pro
Reported in 1 Google interview this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • 2 more worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week
See Google hiring insights
CodePython 3
Run and Submit unlock with Pro
FastPrep Pro
Reported in 1 Google interview this week

Unlock this recently reported problem

FastPrep Pro gives you full access to interview problems reported within the last week.

  • Full problem statement and constraints
  • 2 more worked examples, explained
  • Guided hints and editorial
  • Run your code on real test cases
$8.25/month

$99 billed yearly — or $19 month-to-month. Cancel anytime.

Free plan — 2 of 2 free unlocks used this week