5 lines java solution


  • 0
    Z
    public boolean canAttendMeetings(Interval[] intervals) {
            Arrays.sort(intervals,(a,b)->(a.start-b.start));
            for(int i=0;i<intervals.length-1;i++){
                if(intervals[i+1].start < intervals[i].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.