Practice Reschedule Meetings for Maximum Free Time II
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
You are given an integer eventTime denoting the duration of an event. You are also given two integer arrays startTime and endTime, each of length n. These represent the start and end times of n non-overlapping meetings that occur during the event between time t = 0 and time t = eventTime, where the ith meeting occurs during the time [startTime[i], endTime[i]]. You can reschedule at most one meeting by moving its start time while maintaining the same duration, such that the meetings remain non-overlapping, to maximize the longest continuous period of free time during the event. Return the maximum amount of free time possible after rearranging the meetings. Note that the meetings can not be rescheduled to a time outside the event and they should remain non-overlapping. Note: In this version, it is valid for the relative ordering of the meetings to change after rescheduling one meeting.
Source: Reschedule Meetings for Maximum Free Time II on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
eventTime = 5, startTime = [1,3], endTime = [2,5]
2
# Example 2
eventTime = 10, startTime = [0,7,9], endTime = [1,8,10]
7
# Example 3
eventTime = 10, startTime = [0,3,7,9], endTime = [1,4,8,10]
6
# Example 4
eventTime = 5, startTime = [0,1,2,3,4], endTime = [1,2,3,4,5]
0
Constraints
Related LeetCode Problems
Practice more problems similar to Reschedule Meetings for Maximum Free Time II.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.