def merge(self, itvls):
        """
        scanning. No algorithm
        math
        :param itvls: a list of Interval
        :return: a list of Interval
        """
        if not itvls:
            return []

        itvls.sort(key=lambda x: x.start)  # sort first, since time complexity less than brute force
        ret = [itvls[0]]
        for cur in itvls[1:]:
            pre = ret[-1]
            if pre.end <= cur.start:  # overlap
                pre.end = max(pre.end, cur.end)
            else:
                ret.append(cur)

        return ret
dataset/ETHPy150Open algorhythms/LeetCode/055 Merge Intervals.py/Solution.merge/swapped operands of `<=`