[leetcode]56. Merge Intervals

题目链接:https://leetcode.com/problems/merge-intervals/#/description

Given a collection of intervals, merge all overlapping intervals.

For example,
Given [1,3],[2,6],[8,10],[15,18],
return [1,6],[8,10],[15,18].


class Solution{
public:
    vector merge(vector& intervals)
    {
        vector res;
        if(intervals.empty())
            return res;
        auto cmp=[](Interval a,Interval b){
            if (a.start==b.start)
                return a.end


你可能感兴趣的:(leetcode,贪心)