Given an array of intervals, merge all overlapping intervals and return an array of the non-overlapping intervals that cover all the intervals in the input.
intervals = [[1,3],[2,6],[8,10],[15,18]][[1,6],[8,10],[15,18]]intervals = [[1,4],[4,5]][[1,5]]Solve it in the editor. Sign in free to run your Python or JavaScript against test cases, get a verdict, and track your attempts.
Solve on FeatCode →Problems about ranges — meeting times, event schedules, ranges on a number line — almost always start with sorting the intervals by start (or end) time, then sweeping through them once.
Read the full Intervals guide →
Original problem on LeetCode ↗