@@ -0,0 +1,1316 @@
+%22%22%22%0AGiven a list of intervals, remove all intervals that are covered by another interval in the list.%0A%0AInterval %5Ba,b) is covered by interval %5Bc,d) if and only if c %3C= a and b %3C= d.%0A%0AAfter doing so, return the number of remaining intervals.%0A%0A %0A%0AExample 1:%0A%0AInput: intervals = %5B%5B1,4%5D,%5B3,6%5D,%5B2,8%5D%5D%0AOutput: 2%0AExplanation: Interval %5B3,6%5D is covered by %5B2,8%5D, therefore it is removed.%0AExample 2:%0A%0AInput: intervals = %5B%5B1,4%5D,%5B2,3%5D%5D%0AOutput: 1%0AExample 3:%0A%0AInput: intervals = %5B%5B0,10%5D,%5B5,12%5D%5D%0AOutput: 2%0AExample 4:%0A%0AInput: intervals = %5B%5B3,10%5D,%5B4,10%5D,%5B5,11%5D%5D%0AOutput: 2%0AExample 5:%0A%0AInput: intervals = %5B%5B1,2%5D,%5B1,4%5D,%5B3,4%5D%5D%0AOutput: 1%0A %0A%0AConstraints:%0A%0A1 %3C= intervals.length %3C= 1000%0Aintervals%5Bi%5D.length == 2%0A0 %3C= intervals%5Bi%5D%5B0%5D %3C intervals%5Bi%5D%5B1%5D %3C= 10%5E5%0AAll the intervals are unique.%0A%0A%22%22%22%0A%0Aclass Solution:%0A    def removeCoveredIntervals(self, intervals: List%5BList%5Bint%5D%5D) -%3E int:%0A        intervals.sort()%0A        c = 0%0A        idx = -1%0A        for i, n in enumerate(intervals):%0A            if i == 0:%0A                c += 1%0A                idx = i%0A                continue%0A            t = intervals%5Bidx%5D%0A            if n%5B0%5D == t%5B0%5D and n%5B1%5D %3E= t%5B1%5D:%0A                idx = i%0A                continue%0A            elif n%5B0%5D %3E t%5B0%5D and n%5B1%5D %3C= t%5B1%5D:%0A                continue%0A            c += 1%0A            idx = i%0A        return c%0A        %0A

add remove covered intervals