Given calendars for N attendees, each as a sorted list of non-overlapping, closed-open intervals [start, end) in minutes since epoch, and a required meeting duration d minutes, write a function that returns the earliest start time t such that all attendees are simultaneously available for at least d minutes. If none exists, return -1. Each attendee also has a working-hours window for the day. Follow-ups:
(
-
Redesign the API so the function only considers free slots strictly after the current time without accepting 'now' as an argument; discuss using a monotonic clock, testability, and determinism.
(
-
Handle concurrent updates to calendars while find-meeting calls execute; describe thread-safety (locks vs copy-on-write vs versioned snapshots), data structures, and starvation avoidance.
(
-
Analyze time/space complexity and propose approaches for large inputs (e.g., total intervals up to 1e
6).