#3440

Reschedule Meetings for Maximum Free Time II

specialist · 710 · lc medium +30 · 60.4% accepted · 466 likes · top 59%

Description

You are given an integer eventTime representing the duration of an event. You are also given two arrays startTime and endTime of length n, where the ith meeting runs during [startTime[i], endTime[i]] within the event window [0, eventTime].

Reschedule at most one meeting (shifting its start while keeping its duration) so that meetings stay non-overlapping, to maximize the longest continuous free period.

The rescheduled meeting must remain within the event and meetings may change their relative order.

Return the maximum achievable free time.

Code

1
2
3