diff --git a/729-my-calendar-i/my-calendar-i.java b/729-my-calendar-i/my-calendar-i.java new file mode 100644 index 0000000..92241b1 --- /dev/null +++ b/729-my-calendar-i/my-calendar-i.java @@ -0,0 +1,22 @@ +class MyCalendar { + List calendar; + public MyCalendar() { + calendar = new ArrayList<>(); + } + + public boolean book(int start, int end) { + for(int[] iv: calendar){ + if(iv[0] < end && start < iv[1]){ + return false; + } + } + calendar.add(new int[]{start, end}); + return true; + } +} + +/** + * Your MyCalendar object will be instantiated and called as such: + * MyCalendar obj = new MyCalendar(); + * boolean param_1 = obj.book(start,end); + */ \ No newline at end of file