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

        ret = [itvls[0]]
        for interval in itvls[1:]:
            if ret[-1].end < interval.start:
                ret.append(interval)
                continue
            if ret[-1].start <= interval.start <= ret[-1].end <= interval.end:
                ret[-1].end = interval.end
                continue
            if interval.start <= ret[-1].start and ret[-1].end <= interval.end:
                ret[-1] = interval
                continue
            if ret[-1].start <= interval.start < ret[-1].end and ret[-1].start <= interval.end < ret[-1].end:
                ret.append(interval)
                continue
            if interval.start < ret[-1].start <= interval.end < ret[-1].end:
                ret[-1].start = interval.start
                continue
            if interval.end < ret[-1].start:
                ret.append(ret)
                continue

        return ret
dataset/ETHPy150Open algorhythms/LeetCode/055 Merge Intervals.py/Solution.merge_error/original