● 435. 无重叠区间
class Solution:def eraseOverlapIntervals(self, intervals: List[List[int]]) -> int:if len(intervals)==1:return 0intervals=sorted(intervals,key=lambda x:(x[0],x[1]))res=0for i in range(1,len(intervals)):if intervals[i][0]<intervals[i-1][1]:intervals[i][1]=min(intervals[i-1][1],intervals[i][1])res+=1return res
● 763.划分字母区间
class Solution:def partitionLabels(self, s: str) -> List[int]:last_zm={}for i,ch in enumerate(s):last_zm[ch]=ires=[]start,end=0,0for i,ch in enumerate(s):end=max(end,last_zm[ch])if i==end:res.append(end-start+1)start=i+1return res