class Solution:

    def merge(self, intervals):
        intervals.sort(key=lambda x: x[0])
        result = list()
        for interval in intervals:
            if not result or result[-1][1] < interval[0]:
                result.append(interval)
            else:
                result[-1][1] = max(result[-1][1], interval[1])
        return result


intervals = [[2, 3], [4, 5], [6, 7], [8, 9], [1, 10]]
Solution().merge(intervals)

811513557c2e378bf07582a01ba92dd6bca13ac2
class Solution:
    <mask token>


<mask token>

class Solution:

    def merge(self, intervals):
        intervals.sort(key=lambda x: x[0])
        result = list()
        for interval in intervals:
            if not result or result[-1][1] < interval[0]:
                result.append(interval)
            else:
                result[-1][1] = max(result[-1][1], interval[1])
        return result


<mask token>

class Solution:

    def merge(self, intervals):
        intervals.sort(key=lambda x: x[0])
        result = list()
        for interval in intervals:
            if not result or result[-1][1] < interval[0]:
                result.append(interval)
            else:
                result[-1][1] = max(result[-1][1], interval[1])
        return result


<mask token>
Solution().merge(intervals)

class Solution:

    def merge(self, intervals):
        intervals.sort(key=lambda x: x[0])
        result = list()
        for interval in intervals:
            if not result or result[-1][1] < interval[0]:
                result.append(interval)
            else:
                result[-1][1] = max(result[-1][1], interval[1])
        return result


intervals = [[2, 3], [4, 5], [6, 7], [8, 9], [1, 10]]
Solution().merge(intervals)
