56. 合并区间
为保证权益,题目请参考 56. 合并区间(From LeetCode).
解决方案1
CPP
C++
//
// Created by lenovo on 2020-09-18.
//
#include <iostream>
#include <vector>
#include <algorithm>
using namespace std;
bool cmp(vector<int> &p1, vector<int> &p2) {
return p1[0] < p2[0];
}
class Solution {
public:
vector<vector<int>> merge(vector<vector<int>> &intervals) {
sort(intervals.begin(), intervals.end(), cmp);
}
};
int main() {
return 0;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25