← Google Interview Insights

Google·Software Engineer·Onsite - Coding / Algorithms·Intermediate

IntermediatePrefer not to say
May 2026

Summary

Google SWE coding round with a tricky scheduling problem that had a cyclic twist I didn't see coming. The core concept wasn't hard but the wrap-around time constraint added enough complexity to make me second-guess my whole approach mid-interview.

Questions Asked (1)

Q1

Given a list of meetings with start and end times in a single day, find the minimum number of meeting rooms needed. Meetings can wrap around midnight (e.g. 10 PM to 2 AM), so the schedule is cyclic.

Algorithms & Data StructuresTechnical Trade-offs
Author's notes

The standard meeting rooms problem I'd done before, but the cyclic part broke my initial solution completely.

Create a free account to read the full note

AI HintsAI Generated

Suggested Approach

First, clarify that meetings can wrap around midnight, so the schedule is cyclic. Then, transform the problem into a circular interval graph coloring problem, and use a sweep-line algorithm with a circular array or a priority queue to find the maximum overlap, which equals the minimum rooms needed.

Pro tip: Mention that you can break the cycle by duplicating the day (e.g., consider times modulo 1440 and extend meetings that wrap) to reduce it to a linear sweep, showing you understand how to handle cyclic data without overcomplicating.

1. Clarify the problem

Confirm that meetings can wrap around midnight, meaning the schedule repeats daily, and ask if meetings can be longer than 24 hours or if there are any constraints on the number of meetings.

2. Choose a representation

Decide to represent time in minutes from 0 to 1439, and handle wrap-around by splitting a meeting into two intervals if it crosses midnight, or by duplicating the day and extending meetings that wrap.

3. Apply a sweep-line algorithm

Create events for meeting starts and ends, sort them by time, and sweep through the timeline while maintaining a count of active meetings. For cyclic, either sweep twice or use a circular array to find the maximum overlap.

4. Compute the result

The maximum number of concurrent meetings during the sweep is the minimum number of rooms required. Return that number.

5. Analyze complexity and edge cases

Discuss time complexity O(n log n) due to sorting, and space O(n). Mention edge cases like meetings that exactly touch midnight, zero-length meetings, and all meetings overlapping.

Key Points to Mention

  • Cyclic nature: meetings can wrap around midnight, so the schedule repeats every 24 hours.
  • Reduction to interval graph coloring: minimum rooms equals maximum overlap of intervals.
  • Sweep-line algorithm: sort start and end events, track active meetings.
  • Handling wrap-around: split meetings crossing midnight or duplicate the day.
  • Time complexity: O(n log n) due to sorting, which is optimal for comparison-based sorting.
  • Edge cases: meetings ending exactly at midnight, zero-duration meetings, and all meetings overlapping.

AI-generated suggestions, not part of the candidate's original notes. May be inaccurate — verify before relying on them.