/penr-oz-trick-merge-pairs

Merge a list pairs when the range overlaps

Primary LanguagePython

Trick

Merge pairs

 [] => []
 [[1, 3]] => [[1, 3]]
 [[4, 5], [1, 5]] => [[1, 5]]
 [[2, 6], [1, 10], [4, 8], [8, 10], [15, 18]] => [[1, 10], [15, 18]]