Practice Reschedule Meetings for Maximum Free Time I
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, where the event occurs from time t = 0 to time t = eventTime. You are also given two integer arrays startTime and endTime, each of length n. These represent the start and end time of n non-overlapping meetings, where the ith meeting occurs during the time [startTime[i], endTime[i]]. You can reschedule at most k meetings by moving their start time while maintaining the same duration, to maximize the longest continuous period of free time during the event. The relative order of all the meetings should stay the same and they should remain non-overlapping. 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.
Source: Reschedule Meetings for Maximum Free Time I on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
eventTime = 5, k = 1, startTime = [1,3], endTime = [2,5]
2
# Example 2
eventTime = 10, k = 1, startTime = [0,2,9], endTime = [1,4,10]
6
# Example 3
eventTime = 5, k = 2, 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 I.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.