↓Skip to main content

Intervals

Greedy
·9 mins
Algorithm Greedy Sorting Intervals
Sort then scan, intervals sorted by right end, left and right passes, pairing and parity invariants, adjacent differences, and “remove what exceeds the average”, each with why greedy is correct
LeetCode 253: Meeting Rooms II
·2 mins
LeetCode Medium Heap Sorting Intervals Sweep-Line
LeetCode 253 note: a heap of end times for running meetings; half-open intervals need <=
LeetCode 759: Employee Free Time
·2 mins
LeetCode Hard Heap K-Way-Merge Intervals Sweep-Line
LeetCode 759 note: k-way merge all work intervals by start; any gap after the latest end so far is common free time
LeetCode 3439: Reschedule Meetings for Maximum Free Time (Sliding Window)
·3 mins
LeetCode Daily Medium Array Sliding-Window Two-Pointers Intervals
Sliding window over meetings; track total duration in a k-sized window and compute free span between boundaries.
LeetCode 2402: Meeting Rooms III
·3 mins
LeetCode Hard Heap Sorting Simulation Intervals
LeetCode 2402 note: one heap for free rooms and one for busy rooms; a delayed meeting keeps its original length