lc1546

By | August 26, 2020
Share the joy
  •  
  •  
  •  
  •  
  •  
  •  

subarray

For example, each pair is labeled as [l1, r1]. Because the pairs sequence is ordered by r. So, we can just iterate it. For current pair, if the l is overlapped with previous pair, then don’t consider it. This is a greedy strategy.