Skip to content
This repository was archived by the owner on Sep 20, 2023. It is now read-only.

Latest commit

 

History

History
executable file
·
16 lines (11 loc) · 345 Bytes

File metadata and controls

executable file
·
16 lines (11 loc) · 345 Bytes

题目

Given a collection of intervals, merge all overlapping intervals.

For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].

解题思路

  1. 先对 intervals 进行排序,按照 Start 递增
  2. 依次处理重叠的情况。