from functools import cmp_to_key
class Solution:
def removeCoveredIntervals(self, intervals: List[List[int]]) -> int:
def func(x,y):
if x[0]<y[0]:
return -1
elif x[0]==y[0]:
if x[1]>y[1]:
return -1
elif x[1]==y[1]:
return 0
else:
return 1
else:
return 1
l=sorted(intervals,key=cmp_to_key(func))
i=0
while i<len(l)-1:
if l[i][1]>=l[i+1][1]:
del l[i+1]
else:
i+=1
return len(l)