PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Google

Assign meetings to rooms with delays

Last updated: Mar 29, 2026

Quick Overview

This question evaluates skill in scheduling algorithms, priority queue and heap usage, greedy decision-making, and time-based event simulation for managing limited resources.

  • medium
  • Google
  • Coding & Algorithms
  • Software Engineer

Assign meetings to rooms with delays

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given: - An integer `n` (number of meeting rooms, labeled `0..n-1`). - A list of `m` meetings `meetings[i] = [start_i, end_i)` with `start_i < end_i`. All meetings are processed in increasing order of `start_i` (if two meetings have the same start time, process the one with the earlier end time first). Scheduling rules: 1. If at time `start_i` there is at least one free room, assign the meeting to the free room with the smallest index. The meeting runs during `[start_i, end_i)`. 2. If no rooms are free at time `start_i`, you must **delay** the meeting: wait until the room that becomes available the earliest is free (if multiple rooms free at the same earliest time, pick the smallest index). Then start the meeting immediately at that time, keeping the **same duration** `(end_i - start_i)`. After all meetings are scheduled, return the room index that was used for the **largest number of meetings**. If there is a tie, return the smallest room index. ### Input - `n`: integer - `meetings`: list of pairs `[start, end)` ### Output - Integer room index ### Constraints (typical) - `1 <= n <= 10^3` - `1 <= m <= 2*10^5` - `0 <= start_i < end_i <= 10^9` (Implementation should be efficient enough for large `m`.)

Quick Answer: This question evaluates skill in scheduling algorithms, priority queue and heap usage, greedy decision-making, and time-based event simulation for managing limited resources.

Related Interview Questions

  • Solve Rooms and Top-K Streams - Google (medium)
  • Find Containing Range - Google (medium)
  • Rearrange Tasks With Cooldown - Google (medium)
  • Implement Employee Management and Expression Evaluation - Google (medium)
  • Solve Three Array and Matrix Path Problems - Google (medium)
Google logo
Google
Jan 6, 2026, 12:00 AM
Software Engineer
Technical Screen
Coding & Algorithms
7
0
Loading...

You are given:

  • An integer n (number of meeting rooms, labeled 0..n-1 ).
  • A list of m meetings meetings[i] = [start_i, end_i) with start_i < end_i .

All meetings are processed in increasing order of start_i (if two meetings have the same start time, process the one with the earlier end time first).

Scheduling rules:

  1. If at time start_i there is at least one free room, assign the meeting to the free room with the smallest index. The meeting runs during [start_i, end_i) .
  2. If no rooms are free at time start_i , you must delay the meeting: wait until the room that becomes available the earliest is free (if multiple rooms free at the same earliest time, pick the smallest index). Then start the meeting immediately at that time, keeping the same duration (end_i - start_i) .

After all meetings are scheduled, return the room index that was used for the largest number of meetings. If there is a tie, return the smallest room index.

Input

  • n : integer
  • meetings : list of pairs [start, end)

Output

  • Integer room index

Constraints (typical)

  • 1 <= n <= 10^3
  • 1 <= m <= 2*10^5
  • 0 <= start_i < end_i <= 10^9

(Implementation should be efficient enough for large m.)

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More Coding & Algorithms•More Google•More Software Engineer•Google Software Engineer•Google Coding & Algorithms•Software Engineer Coding & Algorithms
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.