PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/Coding & Algorithms/Google

Simulate room assignments for scheduled meetings

Last updated: Mar 29, 2026

Quick Overview

This question evaluates scheduling and event-simulation skills, including time-ordered processing, resource allocation with tie-breaking, and efficient tracking of room availability and usage counts using appropriate data structures.

  • medium
  • Google
  • Coding & Algorithms
  • Software Engineer

Simulate room assignments for scheduled meetings

Company: Google

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

## Problem You are given **n** meeting rooms labeled `0..n-1` and a list of meetings `meetings`, where each meeting is `[start, end]` with `start < end`. Meetings are processed in **increasing order of start time**. Assign each meeting to a room using these rules: 1. If one or more rooms are free at `start`, assign the meeting to the **free room with the smallest index**. 2. If no rooms are free at `start`, the meeting must **wait** until a room becomes free. It is then scheduled in the room that becomes available **earliest** (break ties by smallest room index). If it waits, its **duration stays the same**, so if the original duration is `end - start` and the room becomes free at time `t`, the meeting runs on `[t, t + (end - start)]`. Each time a meeting is assigned to a room (even after waiting), that room’s meeting count increases by 1. ### Task Return the **index of the room that hosted the most meetings**. If there is a tie, return the **smallest index**. ### Input/Output - Input: `n` (int), `meetings` (list of `[start,end]`) - Output: an integer room index ### Constraints (reasonable interview assumptions) - `1 <= n <= 10^5` - `1 <= len(meetings) <= 10^5` - Times fit in 32-bit signed integer; waiting can increase end times beyond original but still fits in 64-bit.

Quick Answer: This question evaluates scheduling and event-simulation skills, including time-ordered processing, resource allocation with tie-breaking, and efficient tracking of room availability and usage counts using appropriate data structures.

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
5
0
Loading...

Problem

You are given n meeting rooms labeled 0..n-1 and a list of meetings meetings, where each meeting is [start, end] with start < end. Meetings are processed in increasing order of start time.

Assign each meeting to a room using these rules:

  1. If one or more rooms are free at start , assign the meeting to the free room with the smallest index .
  2. If no rooms are free at start , the meeting must wait until a room becomes free. It is then scheduled in the room that becomes available earliest (break ties by smallest room index). If it waits, its duration stays the same , so if the original duration is end - start and the room becomes free at time t , the meeting runs on [t, t + (end - start)] .

Each time a meeting is assigned to a room (even after waiting), that room’s meeting count increases by 1.

Task

Return the index of the room that hosted the most meetings. If there is a tie, return the smallest index.

Input/Output

  • Input: n (int), meetings (list of [start,end] )
  • Output: an integer room index

Constraints (reasonable interview assumptions)

  • 1 <= n <= 10^5
  • 1 <= len(meetings) <= 10^5
  • Times fit in 32-bit signed integer; waiting can increase end times beyond original but still fits in 64-bit.

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.