AC clean Java code(Using lambda)


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