Skip to main content
PreparationZone Logo
PreparationZone
Back to Coding

Coding · Hard · Pro

Find common free time across employees' busy intervals

CodingIntervalsStaff
Model answerPreview

Approach

  • Flatten all busy intervals, sort by start.
  • Merge busy blocks; gaps between merged blocks are free time.
  • Intersection of free windows across lists equals gaps in union of busy.

Java Solution

Java
public List<int[]> freeTime(List<List<int[]>> s…