Merge Open House Windows Into an Agent's Busy Schedule

Last updated: November 29, 2026

Quick Overview

An agent hosts several open houses in a day, each given as a [start, end) window in minutes. Merge overlapping or touching windows into a busy schedule, then return the free gaps inside the agent's working day.

Zillow
Coding & Algorithms
Software Engineer
Zillow
November 29, 2026
Software Engineer
Phone Screen
Coding & Algorithms
Easy

0

0

0 solved


An agent hosts several open houses in a day, each given as a [start, end) window in minutes. Merge overlapping or touching windows into a busy schedule, then return the free gaps inside the agent's working day.

A warm-up in the style of a Zillow phone screen, framed around ShowingTime and tour scheduling where agent calendars decide which tour slots a buyer can book. The interviewer checks that you sort first, handle touching intervals deliberately, and can extend the merge into a gap finder without rewriting it.

What the Interviewer Expects
  • Clarify whether intervals are half-open and whether touching windows merge
  • Sort by start time and merge in one pass
  • Reuse the merged list to compute free gaps clipped to the working day
  • State O(n log n) time and O(n) output space
  • Test empty input and unsorted input
Key Topics to Cover
interval merging
sorting
calendar scheduling
edge cases
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
  • How would you find the earliest slot of at least 45 minutes that is free for both the agent and the buyer?
  • Windows now arrive one at a time from the calendar service. How do you keep the merged schedule updated?
  • What changes if the agent needs 20 minutes of drive time between two different properties?
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 is a list of (start, end) minute offsets, half-open, possibly unsorted. Output one: merged busy blocks in order. Output two: free gaps between day_start and day_end. I will treat touching ...

High-Level Design

Sort by start. Walk the list keeping the last merged block. If the next start is at or before the current end, extend the end to the max of both ends; otherwise start a new block. Gaps fall out of the...


Submit Your Answer
Markdown supported

Related Questions