package leetcode;

/**
 * https://leetcode.com/problems/my-calendar-i/
 */
public class Problem729 {
    private static class MyCalendar {

        public MyCalendar() {

        }

        public boolean book(int start, int end) {
            // TODO
            return false;
        }
    }

    public static void main(String[] args) {
        MyCalendar calendar = new MyCalendar();
        calendar.book(10, 20); // returns true
        calendar.book(15, 25); // returns false
        calendar.book(20, 30); // returns true
    }
}

@@ -12,16 +12,68 @@
 tcode;%0A%0A
+import java.util.ArrayList;%0Aimport java.util.List;%0A%0A
 /**%0A * h
@@ -183,16 +183,76 @@
 lendar %7B
+%0A        private final List%3Cint%5B%5D%3E list = new ArrayList%3C%3E();
 %0A%0A      
@@ -275,17 +275,16 @@
 dar() %7B%0A
-%0A
         
@@ -352,293 +352,226 @@
     
-// TODO%0A            return false;%0A        %7D%0A    %7D%0A%0A    public static void main(String%5B%5D args) %7B%0A        MyCalendar calendar = new MyCalendar();%0A        calendar.book(10, 20); // returns true%0A        calendar.book(15, 25); // returns false%0A        calendar.book(20, 30); //
+for (int%5B%5D i : list) %7B%0A                if (i%5B0%5D %3C end && start %3C i%5B1%5D) %7B%0A                    return false;%0A                %7D%0A            %7D%0A            list.add(new int%5B%5D%7Bstart, end%7D);%0A           
  return
-s
  true
+;%0A        %7D
 %0A   

Solve problem 729