5 line JAVA solution


  • 0
    A
    public boolean canAttendMeetings(Interval[] intervals) {
       Arrays.sort(intervals, (i1,i2)-> i1.end - i2.end);
       for(int 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.