File tree Expand file tree Collapse file tree 1 file changed +30
-0
lines changed
solution/0700-0799/0729.My Calendar I Expand file tree Collapse file tree 1 file changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,36 @@ impl MyCalendar {
254
254
}
255
255
```
256
256
257
+ #### JavaScript
258
+
259
+ ``` js
260
+ var MyCalendar = function () {
261
+ this .calendar = [];
262
+ };
263
+
264
+ /**
265
+ * @param {number} start
266
+ * @param {number} end
267
+ * @return {boolean}
268
+ */
269
+ MyCalendar .prototype .book = function (start , end ) {
270
+ for (const item of this .calendar ) {
271
+ if (end <= item[0 ] || item[1 ] <= start) {
272
+ continue ;
273
+ }
274
+ return false ;
275
+ }
276
+ this .calendar .push ([start, end]);
277
+ return true ;
278
+ };
279
+
280
+ /**
281
+ * Your MyCalendar object will be instantiated and called as such:
282
+ * var obj = new MyCalendar()
283
+ * var param_1 = obj.book(start,end)
284
+ */
285
+ ```
286
+
257
287
<!-- tabs:end -->
258
288
259
289
<!-- solution:end -->
You can’t perform that action at this time.
0 commit comments