Quick Overview

This question evaluates skills in interval manipulation, schedule normalization, time parsing and time-zone handling, and scalable algorithm and data-structure selection for processing large sets of temporal intervals.

Compute shared free time intervals

Company: IBM

Role: Software Engineer

Category: Coding & Algorithms

Difficulty: medium

Interview Round: Technical Screen

You are given schedules for multiple employees. schedules[i] is a list of busy intervals for employee i, where each interval is half-open [start, end) in minutes from 0 to 1440 for a single day. Return all maximal half-open intervals [s, e) during which every employee is free. Requirements: ( 1) Input may contain up to 10^4 total intervals across all employees. ( 2) Intervals within an employee may be unsorted and may overlap; you must normalize as needed. ( 3) Output intervals must be sorted, non-overlapping, and within [0, 1440). Sub-questions: How would you handle schedules provided as strings like "09:30-12:00" and mixed time zones? How would you extend the solution to multiple days or to streaming updates to schedules? Discuss the time and space complexity and the data structures you would choose.

Quick Answer: This question evaluates skills in interval manipulation, schedule normalization, time parsing and time-zone handling, and scalable algorithm and data-structure selection for processing large sets of temporal intervals.

Return all maximal half-open intervals in [0,1440) when every employee is free.

Constraints

  • Inputs are Python literals matching the function signature.
  • Return a deterministic exact-match value.

Examples

Input: ([[[60,120]], [[30,90],[150,180]]],)

Expected Output: [[0, 30], [120, 150], [180, 1440]]

Explanation: Complement of merged busy intervals.

Input: ([[], []],)

Expected Output: [[0, 1440]]

Explanation: Everyone free all day.

Hints

  1. Clarify edge cases before coding.
  2. Keep the return value deterministic.

Loading coding console...