Skip to content

Commit 4316b1e

Browse files
authored
Update README_EN.md
1 parent a5b3b01 commit 4316b1e

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

solution/0700-0799/0729.My Calendar I/README_EN.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,36 @@ impl MyCalendar {
254254
}
255255
```
256256

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+
257287
<!-- tabs:end -->
258288

259289
<!-- solution:end -->

0 commit comments

Comments
 (0)