Skip to content

Commit 5777c89

Browse files
committed
deploy: b901bf8
1 parent be74800 commit 5777c89

File tree

5 files changed

+391
-58
lines changed

5 files changed

+391
-58
lines changed

en/lc/729/index.html

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23459,9 +23459,9 @@
2345923459
<ul class="md-nav__list">
2346023460

2346123461
<li class="md-nav__item">
23462-
<a href="#solution-1" class="md-nav__link">
23462+
<a href="#solution-1-ordered-set" class="md-nav__link">
2346323463
<span class="md-ellipsis">
23464-
Solution 1
23464+
Solution 1: Ordered Set
2346523465
</span>
2346623466
</a>
2346723467

@@ -86064,7 +86064,10 @@ <h2 id="description">Description</h2>
8606486064
<h2 id="solutions">Solutions</h2>
8606586065
<!-- solution:start -->
8606686066

86067-
<h3 id="solution-1">Solution 1</h3>
86067+
<h3 id="solution-1-ordered-set">Solution 1: Ordered Set</h3>
86068+
<p>We can use an ordered set to store the schedule. An ordered set can perform insert, delete, and search operations in $O(\log n)$ time. The elements in the ordered set are sorted by the $\textit{endTime}$ of the schedule in ascending order.</p>
86069+
<p>When calling the $\text{book}(start, end)$ method, we search for the first schedule in the ordered set with an end time greater than $\textit{start}$. If it exists and its start time is less than $\textit{end}$, it means there is a double booking, and we return $\text{false}$. Otherwise, we insert $\textit{end}$ as the key and $\textit{start}$ as the value into the ordered set and return $\text{true}$.</p>
86070+
<p>The time complexity is $O(n \times \log n)$, and the space complexity is $O(n)$. Here, $n$ is the number of schedules.</p>
8606886071
<div class="tabbed-set tabbed-alternate" data-tabs="1:7"><input checked="checked" id="__tabbed_1_1" name="__tabbed_1" type="radio" /><input id="__tabbed_1_2" name="__tabbed_1" type="radio" /><input id="__tabbed_1_3" name="__tabbed_1" type="radio" /><input id="__tabbed_1_4" name="__tabbed_1" type="radio" /><input id="__tabbed_1_5" name="__tabbed_1" type="radio" /><input id="__tabbed_1_6" name="__tabbed_1" type="radio" /><input id="__tabbed_1_7" name="__tabbed_1" type="radio" /><div class="tabbed-labels"><label for="__tabbed_1_1">Python3</label><label for="__tabbed_1_2">Java</label><label for="__tabbed_1_3">C++</label><label for="__tabbed_1_4">Go</label><label for="__tabbed_1_5">TypeScript</label><label for="__tabbed_1_6">Rust</label><label for="__tabbed_1_7">JavaScript</label></div>
8606986072
<div class="tabbed-content">
8607086073
<div class="tabbed-block">

0 commit comments

Comments
 (0)