1. 首页
  2. 数据库
  3. 其它
  4. Leetcode典型题解答和分析、归纳和汇总——T56(合并区间)

Leetcode典型题解答和分析、归纳和汇总——T56(合并区间)

上传者: 2021-01-17 00:28:25上传 PDF文件 35.29KB 热度 9次
题目描述: 给出一个区间的集合,请合并所有重叠的区间; 题目解析: 本题考察简单的数据排序知识点。 class Solution{ public: vector merge(vector& intervals){ vector res; //作为返回结果 if(intervals.empty()) return res; sort(intervals.begin(),intervals.end()); //按照区间的左边界来进行排序 int index=0;
下载地址
用户评论