#4 most askedVery commonMediumIntervals
Merge Intervals
New to Intervals? Learn it from scratch firstIntervals โ
๐ข Asked in real interviews
No reports yet. Were you asked this? Be the first to say where.Given a list of intervals [start, end], merge all overlapping intervals and return the result sorted by start.
[[1, 3], [2, 6], [8, 10], [15, 18]] โ [[1, 6], [8, 10], [15, 18]]
๐งช Practice
Write your solution, then press Run tests. Explain your approach out loud as you go.
def merge(intervals):
pass
Output appears here. Press Run or Ctrl/โ + Enter.
Try it first. Struggling for a few minutes is how it sticks.