Standard Bar Greedy Approach · Medium O(n log n) · O(n)
A production studio has one soundstage and a pile of booking requests, each with a start and finish slot. Only one production can shoot at a time, and a new shoot may begin only strictly after the previous one has wrapped. The coordinator packs the calendar by always accepting the request that frees the stage earliest.
Input: Two integer arrays: start and end times of the meetings.
Output: Return the maximum number of non-conflicting meetings schedulable in the single room.
1 <= n <= 10^50 <= start[i] < end[i] <= 10^9A meeting may start only after the previous chosen meeting endsInput: {"start":[1,3,0,5,8,5],"end":[2,4,6,7,9,9]}
Output: 4
Selecting (1,2), (3,4), (5,7), (8,9) keeps the stage continuously productive with four shoots.
Input: {"start":[10,12,20],"end":[20,25,30]}
Output: 1
Every pair collides: (20,30) meets (10,20) exactly at the boundary, which the strict-start rule forbids.