Given a list of (start, end) integer tuples (in any order), merge all overlapping or touching intervals and return the result as a list of (start, end) tuples sorted ascending by start.
Rules: - Two intervals merge if they overlap OR touch — i.e. the next interval's start is <= the current interval's end (so (1,3) and (3,5) become (1,5)). - A fully contained interval is absorbed ((1,10) swallows (2,3)). - The input is not sorted. Empty input returns [].
What the tests check
6 on Run · 7 on Submit01empty input returns empty list
02single interval unchanged
03disjoint intervals returned sorted, unmerged
04overlapping intervals merge
05touching intervals merge (end == next start)
06fully contained interval absorbed
Submit runs these and one more check you don’t see, so code written for the visible tests alone can still miss.