Fewest Calendar Bookings to Cancel So No Meetings Overlap

Last updated: November 29, 2026

Quick Overview

Given meeting bookings for one Google Calendar room as half-open intervals [start, end), return the minimum number of bookings to cancel so the remaining ones never overlap.

Google
Coding & Algorithms
Software Engineer
Google
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Medium

0

0

0 solved


Given meeting bookings for one Google Calendar room as half-open intervals [start, end), return the minimum number of bookings to cancel so the remaining ones never overlap.

Calendar scheduling is a natural Google framing because Workspace room booking is a real product surface. The interviewer wants the reduction to maximum non-overlapping intervals and a clear statement of why keeping the earliest-ending meeting is safe.

What the Interviewer Expects
  • Reduce to keeping the maximum set of compatible meetings
  • Sort by end time and keep greedily
  • Treat back-to-back meetings as compatible under half-open intervals
  • Explain the stays-ahead or exchange argument
  • O(n log n) time
Key Topics to Cover
Greedy
Activity selection
Intervals
Sorting
How to Approach This
  1. Clarify input constraints and edge cases before writing code.
  2. Walk through your approach verbally and confirm with the interviewer before coding.
  3. Start with a brute force solution, then optimize. Mention time and space complexity.
  4. Test your solution with examples, including edge cases like empty input or duplicates.
  5. Consider common patterns: sliding window, two pointers, hash map, BFS/DFS, dynamic programming.
Possible Follow-up Questions
  • Return which bookings to cancel, not only how many.
  • Each booking has a priority weight; minimize total weight cancelled.
  • There are k rooms instead of one; what is the minimum cancelled?
  • Bookings stream in; maintain the answer as they arrive.
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice DSA Problems
Sample Answer
Requirements

Input: list of [start, end) pairs with start < end. Output: number of bookings to remove so the rest are pairwise disjoint. A meeting ending at 10 and one starting at 10 do not conflict. The weigh...

High-Level Design

Minimizing cancellations equals maximizing kept meetings, which is classic activity selection. Sort by end time. Keep a meeting whenever it starts at or after the end of the last kept meeting; otherwi...


Submit Your Answer
Markdown supported