Clean python code


  • 0
    class Solution(object):
        def merge(self, intervals):
            r = []
            for i in sorted(intervals, key=lambda i: i.start):
                if not r or i.start > r[-1].end:
                    r.append(i)
                elif i.end > r[-1].end:
                    r[-1].end = i.end
            return r

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.