Time Slot Scheduler - Problem
You are building a meeting scheduler application. Given a list of meeting time slots represented as [start, end] intervals, you need to:
1. Find all free time slots during a standard workday (9 AM to 5 PM, represented as [9, 17])
2. Detect any double-bookings (overlapping meetings)
Return a result object containing:
freeSlots: Array of[start, end]intervals representing free timeconflicts: Array of[start, end]intervals representing overlapping meetings
Note: All times are represented as integers (9 = 9 AM, 17 = 5 PM, etc.)
Input & Output
Example 1 — Basic Scheduling
$
Input:
meetings = [[10,12],[11,13],[14,15]]
›
Output:
{"freeSlots":[[9,10],[13,14],[15,17]],"conflicts":[[11,12]]}
💡 Note:
Meeting [11,13] overlaps with [10,12] from 11-12. Free time exists before 10, between 13-14, and after 15.
Example 2 — No Conflicts
$
Input:
meetings = [[9,10],[11,12],[14,16]]
›
Output:
{"freeSlots":[[10,11],[12,14],[16,17]],"conflicts":[]}
💡 Note:
All meetings are separate with no overlaps. Free slots exist in the gaps between meetings.
Example 3 — Multiple Conflicts
$
Input:
meetings = [[10,14],[11,13],[12,15]]
›
Output:
{"freeSlots":[[9,10],[15,17]],"conflicts":[[11,13],[12,14]]}
💡 Note:
Three-way overlap: [11,13] conflicts with [10,14], and [12,15] conflicts with both previous meetings.
Constraints
- 0 ≤ meetings.length ≤ 100
- meetings[i].length == 2
- 0 ≤ starti < endi ≤ 24
- Workday is defined as [9, 17] (9 AM to 5 PM)
Visualization
Tap to expand
💡
Explanation
AI Ready
💡 Suggestion
Tab
to accept
Esc
to dismiss
// Output will appear here after running code