class Solution: def intervalIntersection(self, firstList: List[List[int]], secondList: List[List[int]]) -> List[List[int]]: flp, slp = 0,0 overlaps = [] while flp < len(firstList) and slp < len(secondList): m1 = firstList[flp] m2 = secondList[slp] overlap = [max(m1[0], m2[0]), min(m1[1], m2[1])] if overlap[0] <= overlap[1]: # found valid overlap overlaps.append(overlap) if m1[1] <= m2[1]: flp+=1 else: slp+=1 return overlaps