Skip to content

Commit

Permalink
Time: 82 ms (24.05%) | Memory: 45.5 MB (53.74%) - LeetSync
Browse files Browse the repository at this point in the history
  • Loading branch information
Rupa-Rd committed Sep 26, 2024
1 parent f07319d commit 2c48f88
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions 729-my-calendar-i/my-calendar-i.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
class MyCalendar {
List<int[]> 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);
*/

0 comments on commit 2c48f88

Please sign in to comment.