Simple Java solution

  • 0

    Acknowledgement: comparator code from Senpai vimukthi

    public class Solution {
        public boolean canAttendMeetings(Interval[] intervals) {
            if(intervals.length<2) return true;
            Arrays.sort(intervals, new Comparator<Interval>(){
                public int compare(Interval lhs, Interval rhs){
                    if (lhs.start == rhs.start) return 0;
                    return lhs.start > rhs.start ? 1 : -1;
            for(int i=1;i<intervals.length;i++){
                    return false;
            return true;

Log in to reply

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