Find Shared Focus Time Across Teammates' Busy Calendars

Last updated: November 29, 2026

Quick Overview

Given each teammate's busy intervals for a workday, return every block when nobody is busy that is at least a minimum length, so a team can schedule focus time or a working session.

Asana
Coding & Algorithms
Software Engineer
Asana
November 29, 2026
Software Engineer
Technical Screen
Coding & Algorithms
Medium

0

0

0 solved


Given each teammate's busy intervals for a workday, return every block when nobody is busy that is at least a minimum length, so a team can schedule focus time or a working session.

Asana integrates with calendars and promotes focus time, and interval problems are a common technical screen topic there. The interviewer checks sorting and sweeping, clipping intervals to the day, and careful boundary handling.

What the Interviewer Expects
  • Flattens all calendars and sorts by start
  • Clips intervals to the working day and drops empty or out-of-range ones
  • Sweeps with a running end pointer to find gaps
  • Applies the minimum length filter including the trailing gap
  • Treats intervals as half-open so back-to-back meetings leave no gap
Key Topics to Cover
intervals
sweep line
sorting
merging
boundary conditions
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 return slots where at least k of n teammates are free?
  • How would you handle each teammate's different working hours and time zones?
  • If calendars are already sorted per person, can you do better than a full sort?
  • How would you suggest the single best slot for a 2 hour meeting?
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

Times are minutes from midnight, intervals half-open [start, end). Inputs may overlap, be unsorted, or fall partly outside the day [day_start, day_end). Output: maximal free intervals within the d...

High-Level Design

Who is busy does not matter, only the union of busy time. Clip every interval to the day, sort, and keep a cursor that marks the latest end seen. Any start beyond the cursor opens a gap; after the loo...


Submit Your Answer
Markdown supported