We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent bf35864 commit cb0c193Copy full SHA for cb0c193
solution/0700-0799/0729.My Calendar I/Solution.js
@@ -0,0 +1,26 @@
1
+
2
+var MyCalendar = function() {
3
+ this.calendar = [];
4
+};
5
6
+/**
7
+ * @param {number} start
8
+ * @param {number} end
9
+ * @return {boolean}
10
+ */
11
+MyCalendar.prototype.book = function(start, end) {
12
+ for (const item of this.calendar) {
13
+ if (end <= item[0] || item[1] <= start) {
14
+ continue;
15
+ }
16
+ return false;
17
18
+ this.calendar.push([start, end]);
19
+ return true;
20
21
22
23
+ * Your MyCalendar object will be instantiated and called as such:
24
+ * var obj = new MyCalendar()
25
+ * var param_1 = obj.book(start,end)
26
0 commit comments