leetcode +贪心经典题目,区间覆盖

点击打开链接
//贪心 区间覆盖
struct Interval {
    int start;
    int end;
    Interval() : start(0), end(0) {}
    Interval(int s, int e) : start(s), end(e) {}
};
bool cmp(Interval&x , Interval& y)
{
    if(x.end< y.end) return x.end& intervals) {
        int size = intervals.size();
        if(size==0) return 0;
        int count =0; //移除的区间数
        sort(intervals.begin(), intervals.end(),cmp);
        int g = intervals[0].end;
        for(int i=1; i

你可能感兴趣的:(Leetcode)