package com.fishercoder.solutions;

import com.fishercoder.common.classes.Interval;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

public class _252 {
    public static class Solution1 {
        public boolean canAttendMeetings(Interval[] intervals) {

            List<Interval> list = new ArrayList();
            for (Interval interval : intervals) {
                list.add(interval);
            }

            Collections.sort(list, (o1, o2) -> {
                if (o1.start > o2.start) {
                    return 1;
                } else {
                    return -1;
                }
            });

            for (int i = 0; i < list.size() - 1; i++) {
                if (list.get(i).end > list.get(i + 1).start) {
                    return false;
                }
            }
            return true;
        }
    }
}

@@ -33,57 +33,8 @@
 s;%0A%0A
-import com.fishercoder.common.classes.Interval;%0A%0A
 impo
@@ -208,24 +208,21 @@
 eetings(
-Interval
+int%5B%5D
 %5B%5D inter
@@ -247,24 +247,21 @@
    List%3C
-Interval
+int%5B%5D
 %3E list =
@@ -299,16 +299,13 @@
 or (
-Interval
+int%5B%5D
  int
@@ -451,25 +451,19 @@
  (o1
-.start %3E o2.start
+%5B0%5D %3E o2%5B0%5D
 ) %7B%0A
@@ -674,12 +674,11 @@
 t(i)
-.end
+%5B1%5D
  %3E l
@@ -695,14 +695,11 @@
 + 1)
-.start
+%5B0%5D
 ) %7B%0A

refactor 252