```
class Solution(object):
def merge(self, intervals):
"""
:type intervals: List[Interval]
:rtype: List[Interval]
"""
intervals.sort(key = lambda x: x.start)
i = 1
while i < len(intervals):
if intervals[i].start <= intervals[i-1].end:
intervals[i-1].end = max(intervals[i-1].end, intervals[i].end)
intervals.pop(i)
else:
i += 1
return intervals
```