1
0
mirror of https://gitee.com/coder-xiaomo/leetcode-problemset synced 2025-10-21 13:06:47 +08:00
Code Issues Projects Releases Wiki Activity GitHub Gitee
This commit is contained in:
2025-09-29 14:43:44 +08:00
parent 2862a227c4
commit 13f2098086
4409 changed files with 168933 additions and 166256 deletions

View File

@@ -7,7 +7,7 @@
<li>内含的盒子&nbsp;<code>containedBoxes[i]</code>:整数,表示放在&nbsp;<code>box[i]</code>&nbsp;里的盒子所对应的下标。</li>
</ul>
<p>给你一个&nbsp;<code>initialBoxes</code> 数组,表示你现在得到的盒子你可以获得里面的糖果,也可以用盒子里的钥匙打开新的盒子,还可以继续探索从这个盒子里找到的其他盒子。</p>
<p>给你一个整数数组&nbsp;<code>initialBoxes</code>,包含你最初拥有的盒子你可以拿走每个&nbsp;<strong>已打开盒子&nbsp;</strong>里的所有糖果,并且可以使用其中的钥匙去开启新的盒子,并且可以使用在其中发现的其他盒子。</p>
<p>请你按照上述规则,返回可以获得糖果的 <strong>最大数目&nbsp;</strong></p>
@@ -15,7 +15,8 @@
<p><strong>示例 1</strong></p>
<pre><strong>输入:</strong>status = [1,0,1,0], candies = [7,5,4,100], keys = [[],[],[1],[]], containedBoxes = [[1,2],[3],[],[]], initialBoxes = [0]
<pre>
<strong>输入:</strong>status = [1,0,1,0], candies = [7,5,4,100], keys = [[],[],[1],[]], containedBoxes = [[1,2],[3],[],[]], initialBoxes = [0]
<strong>输出:</strong>16
<strong>解释:
</strong>一开始你有盒子 0 。你将获得它里面的 7 个糖果和盒子 1 和 2。
@@ -26,7 +27,8 @@
<p><strong>示例 2</strong></p>
<pre><strong>输入:</strong>status = [1,0,0,0,0,0], candies = [1,1,1,1,1,1], keys = [[1,2,3,4,5],[],[],[],[],[]], containedBoxes = [[1,2,3,4,5],[],[],[],[],[]], initialBoxes = [0]
<pre>
<strong>输入:</strong>status = [1,0,0,0,0,0], candies = [1,1,1,1,1,1], keys = [[1,2,3,4,5],[],[],[],[],[]], containedBoxes = [[1,2,3,4,5],[],[],[],[],[]], initialBoxes = [0]
<strong>输出:</strong>6
<strong>解释:
</strong>你一开始拥有盒子 0 。打开它你可以找到盒子 1,2,3,4,5 和它们对应的钥匙。
@@ -35,19 +37,22 @@
<p><strong>示例 3</strong></p>
<pre><strong>输入:</strong>status = [1,1,1], candies = [100,1,100], keys = [[],[0,2],[]], containedBoxes = [[],[],[]], initialBoxes = [1]
<pre>
<strong>输入:</strong>status = [1,1,1], candies = [100,1,100], keys = [[],[0,2],[]], containedBoxes = [[],[],[]], initialBoxes = [1]
<strong>输出:</strong>1
</pre>
<p><strong>示例 4</strong></p>
<pre><strong>输入:</strong>status = [1], candies = [100], keys = [[]], containedBoxes = [[]], initialBoxes = []
<pre>
<strong>输入:</strong>status = [1], candies = [100], keys = [[]], containedBoxes = [[]], initialBoxes = []
<strong>输出:</strong>0
</pre>
<p><strong>示例 5</strong></p>
<pre><strong>输入:</strong>status = [1,1,1], candies = [2,3,2], keys = [[],[],[]], containedBoxes = [[],[],[]], initialBoxes = [2,1,0]
<pre>
<strong>输入:</strong>status = [1,1,1], candies = [2,3,2], keys = [[],[],[]], containedBoxes = [[],[],[]], initialBoxes = [2,1,0]
<strong>输出:</strong>7
</pre>