dsa2 min read
Merge Intervals — Sort + Linear Scan O(n log n) [Google, Meta, Amazon]
Merge all overlapping intervals. Sort by start, then merge greedily in one pass. O(n log n) time.
Read →
webcoderspeed.com
6 articles
Merge all overlapping intervals. Sort by start, then merge greedily in one pass. O(n log n) time.
Insert a new interval into a sorted non-overlapping list and merge any overlaps in a single sweep.
Find the minimum number of intervals to remove so the rest are non-overlapping, using a greedy earliest-end-time strategy.
Find the minimum arrows needed to burst all balloons arranged as intervals using a greedy sort-by-end approach.
Minimum removals to make intervals non-overlapping. Sort by end time; greedily keep earliest-ending intervals, count conflicts.
Find minimum arrows to burst all balloons (intervals). Sort by end; one arrow can burst all overlapping intervals. Count arrows needed.