Skip to content

feat: update lc problems #3561

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions solution/0000-0099/0063.Unique Paths II/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,13 @@ tags:

<!-- description:start -->

<p>一个机器人位于一个<meta charset="UTF-8" />&nbsp;<code>m x n</code>&nbsp;网格的左上角 (起始点在下图中标记为 “Start” )。</p>
<p>给定一个&nbsp;<code>m x n</code>&nbsp;的整数数组&nbsp;<code>grid</code>。一个机器人初始位于 <strong>左上角</strong>(即 <code>grid[0][0]</code>)。机器人尝试移动到 <strong>右下角</strong>(即 <code>grid[m - 1][n - 1]</code>)。机器人每次只能向下或者向右移动一步。</p>

<p>机器人每次只能向下或者向右移动一步。机器人试图达到网格的右下角(在下图中标记为 “Finish”)。</p>
<p>网格中的障碍物和空位置分别用 <code>1</code> 和 <code>0</code> 来表示。机器人的移动路径中不能包含 <strong>任何</strong>&nbsp;有障碍物的方格。</p>

<p>现在考虑网格中有障碍物。那么从左上角到右下角将会有多少条不同的路径?</p>
<p>返回机器人能够到达右下角的不同路径数量。</p>

<p>网格中的障碍物和空位置分别用 <code>1</code> 和 <code>0</code> 来表示。</p>
<p>测试用例保证答案小于等于 <code>2 * 10<sup>9</sup></code>。</p>

<p>&nbsp;</p>

Expand Down
2 changes: 1 addition & 1 deletion solution/0100-0199/0191.Number of 1 Bits/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ tags:
<pre>
<strong>输入:</strong>n = 2147483645
<strong>输出:</strong>30
<strong>解释:</strong>输入的二进制串 <strong>11111111111111111111111111111101</strong> 中,共有 30 个设置位。</pre>
<strong>解释:</strong>输入的二进制串 <strong>1111111111111111111111111111101</strong> 中,共有 30 个设置位。</pre>

<p>&nbsp;</p>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@ tags:

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0300-0399/0314.Binary%20Tree%20Vertical%20Order%20Traversal/images/vtree1.jpg" style="width: 282px; height: 301px;" />
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0300-0399/0314.Binary%20Tree%20Vertical%20Order%20Traversal/images/image1.png" style="width: 400px; height: 273px;" />
<pre>
<strong>Input:</strong> root = [3,9,20,null,null,15,7]
<strong>Output:</strong> [[9],[3,15],[20],[7]]
</pre>

<p><strong class="example">Example 2:</strong></p>
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0300-0399/0314.Binary%20Tree%20Vertical%20Order%20Traversal/images/vtree2-1.jpg" style="width: 462px; height: 222px;" />
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0300-0399/0314.Binary%20Tree%20Vertical%20Order%20Traversal/images/image3.png" style="width: 450px; height: 285px;" />
<pre>
<strong>Input:</strong> root = [3,9,8,4,0,1,7]
<strong>Output:</strong> [[4],[9],[3,0,1],[8],[7]]
</pre>

<p><strong class="example">Example 3:</strong></p>
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0300-0399/0314.Binary%20Tree%20Vertical%20Order%20Traversal/images/vtree2.jpg" style="width: 462px; height: 302px;" />
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0300-0399/0314.Binary%20Tree%20Vertical%20Order%20Traversal/images/image2.png" style="width: 350px; height: 342px;" />
<pre>
<strong>Input:</strong> root = [3,9,8,4,0,1,7,null,null,null,2,5]
<strong>Output:</strong> [[4],[9,5],[3,0,1],[8,2],[7]]
<strong>Input:</strong> root = [1,2,3,4,10,9,11,null,5,null,null,null,null,null,null,null,6]
<strong>Output:</strong> [[4],[2,5],[1,10,9,6],[3],[11]]
</pre>

<p>&nbsp;</p>
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ tags:

<p>&nbsp;</p>

<p><img src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0400-0499/0428.Serialize%20and%20Deserialize%20N-ary%20Tree/images/narytreeexample.png" style="height: 321px; width: 500px;" /></p>
<p><img src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0400-0499/0428.Serialize%20and%20Deserialize%20N-ary%20Tree/images/1727093143-BPVnoI-image.png" style="height: 321px; width: 500px;" /></p>

<p>&nbsp;</p>

<p>为&nbsp;<code>[1 [3[5 6] 2 4]]</code>。你不需要以这种形式完成,你可以自己创造和实现不同的方法。</p>

<p>或者,您可以遵循 LeetCode 的层序遍历序列化格式,其中每组孩子节点由空值分隔。</p>

<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0400-0499/0428.Serialize%20and%20Deserialize%20N-ary%20Tree/images/sample_4_964.png" style="height: 454px; width: 500px;" /></p>
<p><img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0400-0499/0428.Serialize%20and%20Deserialize%20N-ary%20Tree/images/1727093169-WGFOps-image.png" style="height: 454px; width: 500px;" /></p>

<p>例如,上面的树可以序列化为 <code>[1,null,2,3,4,5,null,null,6,7,null,8,null,9,10,null,null,11,null,12,null,13,null,null,14]</code></p>

Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions solution/0900-0999/0929.Unique Email Addresses/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ tags:
<li>每个 <code>emails[i]</code> 都包含有且仅有一个 <code>'@'</code> 字符</li>
<li>所有本地名和域名都不为空</li>
<li>本地名不会以 <code>'+'</code> 字符作为开头</li>
<li>域名以&nbsp;<code>".com"</code> 后缀结尾。</li>
<li>域名在&nbsp;<code>".com"</code> 后缀前至少包含一个字符</li>
</ul>

<!-- description:end -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ tags:
<li>All local and domain names are non-empty.</li>
<li>Local names do not start with a <code>&#39;+&#39;</code> character.</li>
<li>Domain names end with the <code>&quot;.com&quot;</code> suffix.</li>
<li>Domain names must contain at least one character before <code>&quot;.com&quot;</code> suffix.</li>
</ul>

<!-- description:end -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ tags:
<p>各查询结果的评分与其位置之间比率的平均值。</p>
</blockquote>

<p>将劣质查询百分比&nbsp;<code>poor_query_percentage</code>:</p>
<p>将劣质查询百分比&nbsp;<code>poor_query_percentage</code>&nbsp;定义为:</p>

<blockquote>
<p>评分小于 3 的查询结果占全部查询结果的百分比。</p>
Expand Down
28 changes: 15 additions & 13 deletions solution/1600-1699/1666.Change the Root of a Binary Tree/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,42 +18,44 @@ tags:

<!-- description:start -->

<p>给定一棵二叉树的根节点 <code>root</code> 和一个叶节点 <code>leaf</code> ,更改二叉树,使得 <code>leaf</code> 为新的根节点。</p>
<p>给定一棵二叉树的根节点&nbsp;<code>root</code>&nbsp;和一个叶节点&nbsp;<code>leaf</code> ,更改二叉树,使得&nbsp;<code>leaf</code>&nbsp;为新的根节点。</p>

<p>你可以按照下列步骤修改<strong>从</strong> <code>leaf</code> <strong>到</strong> <code>root</code> <strong>的路径中除</strong> <code>root</code> <strong>外的每个节点</strong> <code>cur</code> :</p>
<p>你可以按照下列步骤修改<strong>从</strong> <code>leaf</code>&nbsp;<strong>到</strong> <code>root</code>&nbsp;<strong>的路径中除</strong> <code>root</code> <strong>外的每个节点</strong> <code>cur</code>&nbsp;:</p>

<ol>
<li>如果 <code>cur</code> 有左子节点,则该子节点变为 <code>cur</code> 的右子节点。注意我们保证 <code>cur</code> 至多有一个子节点。</li>
<li><code>cur</code> 的原父节点变为 <code>cur</code> 的左子节点。</li>
<li>如果&nbsp;<code>cur</code>&nbsp;有左子节点,则该子节点变为&nbsp;<code>cur</code>&nbsp;的右子节点。注意我们保证&nbsp;<code>cur</code>&nbsp;至多有一个子节点。</li>
<li><code>cur</code>&nbsp;的原父节点变为&nbsp;<code>cur</code>&nbsp;的左子节点。</li>
</ol>

<p>返回修改后新树的根节点。</p>

<p><b>注意:</b>确保你的答案在操作后正确地设定了 <code>Node.parent</code> (父节点)指针,否则会被判为错误答案。</p>
<p><b>注意:</b>确保你的答案在操作后正确地设定了&nbsp;<code>Node.parent</code>&nbsp;(父节点)指针,否则会被判为错误答案。</p>

<p> </p>
<p>&nbsp;</p>

<p><strong>示例 1:</strong></p>
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1600-1699/1666.Change%20the%20Root%20of%20a%20Binary%20Tree/images/fliptree.png" style="width: 400px; height: 298px;">
<pre><strong>输入:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], leaf = 7
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1600-1699/1666.Change%20the%20Root%20of%20a%20Binary%20Tree/images/1727138189-YtDgTf-image.png" style="width: 500px; height: 262px;" />
<pre>
<strong>输入:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], leaf = 7
<strong>输出:</strong> [7,2,null,5,4,3,6,null,null,null,1,null,null,0,8]
</pre>

<p><strong>示例 2:</strong></p>

<pre><strong>输入:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], leaf = 0
<pre>
<strong>输入:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], leaf = 0
<strong>输出:</strong> [0,1,null,3,8,5,null,null,null,6,2,null,null,7,4]
</pre>

<p> </p>
<p>&nbsp;</p>

<p><strong>提示:</strong></p>

<ul>
<li>树中节点的个数在范围 <code>[2, 100]</code> 内。</li>
<li>树中节点的个数在范围&nbsp;<code>[2, 100]</code>&nbsp;内。</li>
<li><code>-10<sup>9</sup> &lt;= Node.val &lt;= 10<sup>9</sup></code></li>
<li>所有的 <code>Node.val</code> 都是<strong>唯一</strong>的。</li>
<li><code>leaf</code> 存在于树中。</li>
<li>所有的&nbsp;<code>Node.val</code>&nbsp;都是<strong>唯一</strong>的。</li>
<li><code>leaf</code>&nbsp;存在于树中。</li>
</ul>

<!-- description:end -->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ tags:

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1600-1699/1666.Change%20the%20Root%20of%20a%20Binary%20Tree/images/fliptree.png" style="width: 400px; height: 298px;" />
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/1600-1699/1666.Change%20the%20Root%20of%20a%20Binary%20Tree/images/bt_image_1.png" style="width: 500px; height: 262px;" />
<pre>
<strong>Input:</strong> root = [3,5,1,6,2,0,8,null,null,7,4], leaf = 7
<strong>Output:</strong> [7,2,null,5,4,3,6,null,null,null,1,null,null,0,8]
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -20,63 +20,44 @@ tags:
<p>Given an array of strings <code>words</code>, find the <strong>longest</strong> string in <code>words</code> such that <strong>every prefix</strong> of it is also in <code>words</code>.</p>

<ul>

<li>For example, let <code>words = [&quot;a&quot;, &quot;app&quot;, &quot;ap&quot;]</code>. The string <code>&quot;app&quot;</code> has prefixes <code>&quot;ap&quot;</code> and <code>&quot;a&quot;</code>, all of which are in <code>words</code>.</li>

<li>For example, let <code>words = [&quot;a&quot;, &quot;app&quot;, &quot;ap&quot;]</code>. The string <code>&quot;app&quot;</code> has prefixes <code>&quot;ap&quot;</code> and <code>&quot;a&quot;</code>, all of which are in <code>words</code>.</li>
</ul>

<p>Return <em>the string described above. If there is more than one string with the same length, return the <strong>lexicographically smallest</strong> one, and if no string exists, return </em><code>&quot;&quot;</code>.</p>

<p>&nbsp;</p>

<p><strong class="example">Example 1:</strong></p>

<pre>

<strong>Input:</strong> words = [&quot;k&quot;,&quot;ki&quot;,&quot;kir&quot;,&quot;kira&quot;, &quot;kiran&quot;]

<strong>Output:</strong> &quot;kiran&quot;

<strong>Explanation:</strong> &quot;kiran&quot; has prefixes &quot;kira&quot;, &quot;kir&quot;, &quot;ki&quot;, and &quot;k&quot;, and all of them appear in words.

</pre>

<p><strong class="example">Example 2:</strong></p>

<pre>

<strong>Input:</strong> words = [&quot;a&quot;, &quot;banana&quot;, &quot;app&quot;, &quot;appl&quot;, &quot;ap&quot;, &quot;apply&quot;, &quot;apple&quot;]

<strong>Output:</strong> &quot;apple&quot;

<strong>Explanation:</strong> Both &quot;apple&quot; and &quot;apply&quot; have all their prefixes in words.

However, &quot;apple&quot; is lexicographically smaller, so we return that.

</pre>

<p><strong class="example">Example 3:</strong></p>

<pre>

<strong>Input:</strong> words = [&quot;abc&quot;, &quot;bc&quot;, &quot;ab&quot;, &quot;qwe&quot;]

<strong>Output:</strong> &quot;&quot;

</pre>

<p>&nbsp;</p>

<p><strong>Constraints:</strong></p>

<ul>

<li><code>1 &lt;= words.length &lt;= 10<sup>5</sup></code></li>

<li><code>1 &lt;= words[i].length &lt;= 10<sup>5</sup></code></li>

<li><code>1 &lt;= sum(words[i].length) &lt;= 10<sup>5</sup></code></li>

<li><code>1 &lt;= words.length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= words[i].length &lt;= 10<sup>5</sup></code></li>
<li><code>1 &lt;= sum(words[i].length) &lt;= 10<sup>5</sup></code></li>
<li><code>words[i]</code> consists only of lowercase English letters.</li>
</ul>

<!-- description:end -->
Expand Down
45 changes: 31 additions & 14 deletions solution/2000-2099/2073.Time Needed to Buy Tickets/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,23 +32,40 @@ tags:

<p><strong>示例 1:</strong></p>

<pre><strong>输入:</strong>tickets = [2,3,2], k = 2
<strong>输出:</strong>6
<strong>解释:</strong>
- 第一轮,队伍中的每个人都买到一张票,队伍变为 [1, 2, 1] 。
- 第二轮,队伍中的每个都又都买到一张票,队伍变为 [0, 1, 0] 。
位置 2 的人成功买到 2 张票,用掉 3 + 3 = 6 秒。
</pre>
<div class="example-block"><strong>输入:</strong>tickets = [2,3,2], k = 2</div>

<div class="example-block"><strong>输出:</strong>6</div>

<div class="example-block"><strong>解释:</strong></div>

<div class="example-block">&nbsp;</div>

<ul>
<li class="example-block">队伍一开始为 [2,3,2],第 k 个人以下划线标识。</li>
<li class="example-block">在最前面的人买完票后,队伍在第 1 秒变成 [3,<u>2</u>,1]。</li>
<li class="example-block">继续这个过程,队伍在第 2 秒变为[<u>2</u>,1,2]。</li>
<li class="example-block">继续这个过程,队伍在第 3 秒变为[1,2,<u>1</u>]。</li>
<li class="example-block">继续这个过程,队伍在第 4 秒变为[2,<u>1</u>]。</li>
<li class="example-block">继续这个过程,队伍在第 5 秒变为[<u>1</u>,1]。</li>
<li class="example-block">继续这个过程,队伍在第 6 秒变为[1]。第 k 个人完成买票,所以返回 6。</li>
</ul>

<div class="example-block">&nbsp;</div>

<p><strong>示例 2:</strong></p>

<pre><strong>输入:</strong>tickets = [5,1,1,1], k = 0
<strong>输出:</strong>8
<strong>解释:</strong>
- 第一轮,队伍中的每个人都买到一张票,队伍变为 [4, 0, 0, 0] 。
- 接下来的 4 轮,只有位置 0 的人在买票。
位置 0 的人成功买到 5 张票,用掉 4 + 1 + 1 + 1 + 1 = 8 秒。
</pre>
<div class="example-block"><strong>输入:</strong>tickets = [5,1,1,1], k = 0</div>

<div class="example-block"><strong>输出:</strong>8</div>

<div class="example-block"><strong>解释:</strong></div>

<ul>
<li class="example-block">队伍一开始为 [<u>5</u>,1,1,1],第 k 个人以下划线标识。</li>
<li class="example-block">在最前面的人买完票后,队伍在第 1 秒变成 [1,1,1,<u>4</u>]。</li>
<li class="example-block">继续这个过程 3 秒,队伍在第 4&nbsp;秒变为[<u>4</u>]。</li>
<li class="example-block">继续这个过程 4 秒,队伍在第 8&nbsp;秒变为[]。第 k 个人完成买票,所以返回 8。</li>
</ul>

<p>&nbsp;</p>

Expand Down
49 changes: 32 additions & 17 deletions solution/2000-2099/2073.Time Needed to Buy Tickets/README_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,45 @@ tags:

<p>Each person takes <strong>exactly 1 second</strong> to buy a ticket. A person can only buy <strong>1 ticket at a time</strong> and has to go back to <strong>the end</strong> of the line (which happens <strong>instantaneously</strong>) in order to buy more tickets. If a person does not have any tickets left to buy, the person will <strong>leave </strong>the line.</p>

<p>Return <em>the <strong>time taken</strong> for the person at position </em><code>k</code><em>&nbsp;</em><strong><em>(0-indexed)</em>&nbsp;</strong><em>to finish buying tickets</em>.</p>
<p>Return the <strong>time taken</strong> for the person <strong>initially</strong> at position <strong>k</strong><strong> </strong>(0-indexed) to finish buying tickets.</p>

<p>&nbsp;</p>
<p><strong class="example">Example 1:</strong></p>

<pre>
<strong>Input:</strong> tickets = [2,3,2], k = 2
<strong>Output:</strong> 6
<strong>Explanation:</strong>
- In the first pass, everyone in the line buys a ticket and the line becomes [1, 2, 1].
- In the second pass, everyone in the line buys a ticket and the line becomes [0, 1, 0].
The person at&nbsp;position 2 has successfully bought 2 tickets and it took 3 + 3 = 6 seconds.
</pre>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">tickets = [2,3,2], k = 2</span></p>

<p><strong>Output:</strong> <span class="example-io">6</span></p>

<p><strong>Explanation:</strong></p>

<ul>
<li>The queue starts as [2,3,<u>2</u>], where the kth person is underlined.</li>
<li>After the person at the front has bought a ticket, the queue becomes [3,<u>2</u>,1] at 1 second.</li>
<li>Continuing this process, the queue becomes [<u>2</u>,1,2] at 2 seconds.</li>
<li>Continuing this process, the queue becomes [1,2,<u>1</u>] at 3 seconds.</li>
<li>Continuing this process, the queue becomes [2,<u>1</u>] at 4 seconds. Note: the person at the front left the queue.</li>
<li>Continuing this process, the queue becomes [<u>1</u>,1] at 5 seconds.</li>
<li>Continuing this process, the queue becomes [1] at 6 seconds. The kth person has bought all their tickets, so return 6.</li>
</ul>
</div>

<p><strong class="example">Example 2:</strong></p>

<pre>
<strong>Input:</strong> tickets = [5,1,1,1], k = 0
<strong>Output:</strong> 8
<strong>Explanation:</strong>
- In the first pass, everyone in the line buys a ticket and the line becomes [4, 0, 0, 0].
- In the next 4 passes, only the person in position 0 is buying tickets.
The person at&nbsp;position 0 has successfully bought 5 tickets and it took 4 + 1 + 1 + 1 + 1 = 8 seconds.
</pre>
<div class="example-block">
<p><strong>Input:</strong> <span class="example-io">tickets = [5,1,1,1], k = 0</span></p>

<p><strong>Output:</strong> <span class="example-io">8</span></p>

<p><strong>Explanation:</strong></p>

<ul>
<li>The queue starts as [<u>5</u>,1,1,1], where the kth person is underlined.</li>
<li>After the person at the front has bought a ticket, the queue becomes [1,1,1,<u>4</u>] at 1 second.</li>
<li>Continuing this process for 3 seconds, the queue becomes [<u>4]</u> at 4 seconds.</li>
<li>Continuing this process for 4 seconds, the queue becomes [] at 8 seconds. The kth person has bought all their tickets, so return 8.</li>
</ul>
</div>

<p>&nbsp;</p>
<p><strong>Constraints:</strong></p>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ tags:

<p>给你一个整数&nbsp;<code>capacity</code>&nbsp;,表示每辆公交车&nbsp;<strong>最多</strong>&nbsp;能容纳的乘客数目。</p>

<p>每位乘客都会搭乘下一辆有座位的公交车。如果你在 <code>y</code>&nbsp;时刻到达,公交在&nbsp;<code>x</code>&nbsp;时刻出发,满足&nbsp;<code>y &lt;= x</code>&nbsp;&nbsp;且公交没有满,那么你可以搭乘这一辆公交。<strong>最早</strong>&nbsp;到达的乘客优先上车。</p>
<p>每位乘客都会排队搭乘下一辆有座位的公交车。如果你在 <code>y</code>&nbsp;时刻到达,公交在&nbsp;<code>x</code>&nbsp;时刻出发,满足&nbsp;<code>y &lt;= x</code>&nbsp;&nbsp;且公交没有满,那么你可以搭乘这一辆公交。<strong>最早</strong>&nbsp;到达的乘客优先上车。</p>

<p>返回你可以搭乘公交车的最晚到达公交站时间。你 <strong>不能</strong>&nbsp;跟别的乘客同时刻到达。</p>

Expand All @@ -35,7 +35,8 @@ tags:

<p><strong>示例 1:</strong></p>

<pre><b>输入:</b>buses = [10,20], passengers = [2,17,18,19], capacity = 2
<pre>
<b>输入:</b>buses = [10,20], passengers = [2,17,18,19], capacity = 2
<b>输出:</b>16
<strong>解释:</strong>
第 1 辆公交车载着第 1 位乘客。
Expand All @@ -44,7 +45,8 @@ tags:

<p><strong>示例 2:</strong></p>

<pre><b>输入:</b>buses = [20,30,10], passengers = [19,13,26,4,25,11,21], capacity = 2
<pre>
<b>输入:</b>buses = [20,30,10], passengers = [19,13,26,4,25,11,21], capacity = 2
<b>输出:</b>20
<b>解释:</b>
第 1 辆公交车载着第 4 位乘客。
Expand Down
Loading
Loading