Merge Intervals

Given an array of intervals where each interval is represented as [start, end], merge all overlapping intervals and return an array of non-overlapping intervals that cover all the intervals in the input.

Constraints

  • 1 <= intervals.length <= 10^4
  • intervals[i].length == 2
  • 0 <= start <= end <= 10^4
Saving… · 2 lines
class Solution:
def mergeIntervals(self, intervals: List[List[int]]) -> List[List[int]]:
Console

Click Run to execute sample tests.