Find Open Tour Slots Around a Leasing Agent's Busy Calendar

Last updated: November 29, 2026

Quick Overview

Given a property's office hours and a leasing agent's list of busy intervals (which may overlap or spill outside office hours), return the start times of every free 30-minute tour slot.

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

0

0

0 solved


Given a property's office hours and a leasing agent's list of busy intervals (which may overlap or spill outside office hours), return the start times of every free 30-minute tour slot.

Tour scheduling is the core action an AI leasing assistant takes when a prospect texts 'can I see a 2 bed Saturday?'. A phone screen version checks whether you can merge intervals cleanly, clip them to a window, and handle boundaries without off-by-one bugs.

What the Interviewer Expects
  • Clip busy intervals to office hours before merging
  • Sort and merge overlapping or touching intervals
  • Walk the gaps and emit fixed-length slots that fully fit
  • Handle empty calendars and fully booked days
  • State O(n log n) complexity
Key Topics to Cover
interval merging
sorting
scheduling
boundary handling
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 align slots to the half hour instead of to the end of each busy block?
  • Two agents can both give tours: return slots where at least one is free.
  • Add a 15-minute buffer after every existing tour.
  • How do time zones and daylight saving change your representation?
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

Inputs are minutes since midnight: open_min, close_min, and a list of (start, end) busy intervals, half open. Output is the list of start minutes for 30-minute slots that lie entirely within off...

High-Level Design
  1. Drop intervals that are entirely outside office hours and clip the rest.
  2. Sort by start and merge overlapping intervals (touching intervals can merge too, since a zero-length gap fits nothing). 3...

Submit Your Answer
Markdown supported

Related Questions