If you Like the content the plzz Subscribe 😄. CODE: class Solution { public: int minRemoval(vector &intervals) { sort(intervals.begin(),intervals.end(),[](vector& a,vector& b){ return a[1] < b[1]; }); int count = 0; int last = intervals[0][1]; for(int i=1;i intervals[i][0]){ count++; } else{ last = intervals[i][1]; } } return count; } };
If you Like the content the plzz Subscribe 😄.
CODE:
class Solution {
public:
int minRemoval(vector &intervals) {
sort(intervals.begin(),intervals.end(),[](vector& a,vector& b){
return a[1] < b[1];
});
int count = 0;
int last = intervals[0][1];
for(int i=1;i intervals[i][0]){
count++;
}
else{
last = intervals[i][1];
}
}
return count;
}
};