We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 6c45667 commit a2fc577Copy full SHA for a2fc577
merge-intervals/hu6r1s.py
@@ -0,0 +1,9 @@
1
+class Solution:
2
+ def merge(self, intervals: List[List[int]]) -> List[List[int]]:
3
+ result = []
4
+ for interval in sorted(intervals):
5
+ if not result or result[-1][1] < interval[0]:
6
+ result.append(interval)
7
+ else:
8
+ result[-1][1] = max(result[-1][1], interval[1])
9
+ return result
0 commit comments