### 解题思路
贪心策略:按照右端点从小到大排序,然后拼接区间
### 代码
class Solution {
public:
static bool cmp(vector<int>& a,vector<int>& b){
return a[1] < b[1];
}
int eraseOverlapIntervals(vector<vector<int>>& intervals) {
if(intervals.size() == 0) return 0;
sort(intervals.begin(),intervals.end(),cmp);
int n = intervals.size();
int count = 1;
int last = intervals[0][1];
for(int i = 1; i < n; ++i){
if(last <= intervals[i][0]){
count++;
last = intervals[i][1];
}
}
return n-count;
}
};