Given an array of intervals where intervals[i] = [start_i, end_i], 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]]1 <= intervals.length <= 10^4intervals[i].length == 20 <= start_i <= end_i <= 10^4Expected time complexity: O(n log n)Run your code to see results
Use Cmd+Enter to run