1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-01-25 17:50:26 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
leetcode-problemset/leetcode-cn/problem (Chinese)/无需开会的工作日 [count-days-without-meetings].html
2024-06-05 08:50:06 +08:00

55 lines
1.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<p>给你一个正整数 <code>days</code>,表示员工可工作的总天数(从第 1 天开始)。另给你一个二维数组 <code>meetings</code>,长度为 <code>n</code>,其中 <code>meetings[i] = [start_i, end_i]</code> 表示第 <code>i</code> 次会议的开始和结束天数(包含首尾)。</p>
<p>返回员工可工作且没有安排会议的天数。</p>
<p><strong>注意:</strong>会议时间可能会有重叠。</p>
<p>&nbsp;</p>
<p><strong class="example">示例 1</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">days = 10, meetings = [[5,7],[1,3],[9,10]]</span></p>
<p><strong>输出:</strong><span class="example-io">2</span></p>
<p><strong>解释:</strong></p>
<p>第 4 天和第 8 天没有安排会议。</p>
</div>
<p><strong class="example">示例 2</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">days = 5, meetings = [[2,4],[1,3]]</span></p>
<p><strong>输出:</strong><span class="example-io">1</span></p>
<p><strong>解释:</strong></p>
<p>第 5 天没有安排会议。</p>
</div>
<p><strong class="example">示例 3</strong></p>
<div class="example-block">
<p><strong>输入:</strong><span class="example-io">days = 6, meetings = [[1,6]]</span></p>
<p><strong>输出:</strong>0</p>
<p><strong>解释:</strong></p>
<p>所有工作日都安排了会议。</p>
</div>
<p>&nbsp;</p>
<p><strong>提示:</strong></p>
<ul>
<li><code>1 &lt;= days &lt;= 10<sup>9</sup></code></li>
<li><code>1 &lt;= meetings.length &lt;= 10<sup>5</sup></code></li>
<li><code>meetings[i].length == 2</code></li>
<li><code>1 &lt;= meetings[i][0] &lt;= meetings[i][1] &lt;= days</code></li>
</ul>