Intuitive Javascript Solution


  • 0
    D
    var canAttendMeetings = function(intervals) {
        intervals.sort((a, b) => a.start - b.start);
        
        // can't attend if the next meeting starts before the previous ends
        for (let i = 1; i < intervals.length; i++)
            if (intervals[i].start < intervals[i-1].end) return false;
            
        return true;
    };
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.