```
class Solution {
private:
struct comp{
bool operator()(Interval a, Interval b){
return a.start<b.start;
}
};
public:
int eraseOverlapIntervals(vector<Interval>& intervals) {
sort(intervals.begin(),intervals.end(),comp());
int index=INT_MIN;
int result=0;
for(int i=0;i<intervals.size();i++){
if(intervals[i].start<index&&intervals[i].start!=INT_MIN){
index=min(index,intervals[i].end);
result++;continue;
}
index=intervals[i].end;
}
return result;
}
};
```