Skip to content

Instantly share code, notes, and snippets.

@Ifihan
Created July 10, 2025 23:02
Show Gist options
  • Save Ifihan/48268072523bf48b78e33affc0c8698e to your computer and use it in GitHub Desktop.
Save Ifihan/48268072523bf48b78e33affc0c8698e to your computer and use it in GitHub Desktop.
Reschedule Meetings for Maximum Free Time II

Question

Approach

To solve this, I first calculated the duration of each meeting. My goal was to find the maximum continuous free time that can exist after rescheduling at most one meeting to a different valid time slot.

I iterated over each meeting and considered removing it from its original slot. Then, I tried inserting it into any valid gap between the remaining meetings, including at the very beginning or end of the event window. For each valid rescheduling, I recomputed the free time gaps and tracked the maximum possible value across all such reschedules.

This approach failed (557/695) so I went to the editiorial

image
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment