leetle

Daily challenge for 2026-06-02

518. Earliest Available Meeting Slot

You are given a list of busy time intervals for a meeting room, where each interval is represented as [start, end]. You are also given the duration of a new meeting you need to schedule. Find the earliest possible start time for the new meeting that does not overlap with any busy intervals. The room is available starting from time 0. The new meeting can start exactly when a busy interval ends.

Example:
Input: intervals = [[10, 50], [60, 120]], duration = 20
Output: 120

Note: In the example, the gap between 0 and 10 is only 10, which is less than the duration 20. The gap between 50 and 60 is 10. Thus, the earliest available time is after the last interval at 120.

Run this challenge interactively in Python or JavaScript when the app loads.