Posted on

Description

Submission

class Solution {
public:
    bool canAttendMeetings(vector<vector<int>>& intervals) {
        if(intervals.empty()) return true;
        sort(intervals.begin(), intervals.end(), []
            (vector<int>& v1, vector<int>& v2) {
                return v1[0] < v2[0];
            });

        for(int i = 0; i < intervals.size()-1; ++i) {
            if(intervals[i][1] > intervals[i+1][0]) return false;
        }

        return true;
    }
};

Leave a Reply

Your email address will not be published. Required fields are marked *