Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3b37d75

Browse files
author
openset
committed
Add: new
1 parent ec525e9 commit 3b37d75

File tree

19 files changed

+409
-21
lines changed

19 files changed

+409
-21
lines changed

‎README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ LeetCode Problems' Solutions
6262

6363
| # | Title | Solution | Difficulty |
6464
| :-: | - | - | :-: |
65+
| <span id="1298">1298</span> | [Maximum Candies You Can Get from Boxes](https://leetcode.com/problems/maximum-candies-you-can-get-from-boxes "你能从盒子里获得的最大糖果数") | [Go](problems/maximum-candies-you-can-get-from-boxes) | Hard |
66+
| <span id="1297">1297</span> | [Maximum Number of Occurrences of a Substring](https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring "子串的最大出现次数") | [Go](problems/maximum-number-of-occurrences-of-a-substring) | Medium |
67+
| <span id="1296">1296</span> | [Divide Array in Sets of K Consecutive Numbers](https://leetcode.com/problems/divide-array-in-sets-of-k-consecutive-numbers "划分数组为连续数字的集合") | [Go](problems/divide-array-in-sets-of-k-consecutive-numbers) | Medium |
68+
| <span id="1295">1295</span> | [Find Numbers with Even Number of Digits](https://leetcode.com/problems/find-numbers-with-even-number-of-digits "统计位数为偶数的数字") | [Go](problems/find-numbers-with-even-number-of-digits) | Easy |
69+
| <span id="1294">1294</span> | [Weather Type in Each Country](https://leetcode.com/problems/weather-type-in-each-country) 🔒 | [MySQL](problems/weather-type-in-each-country) | Easy |
6570
| <span id="1293">1293</span> | [Shortest Path in a Grid with Obstacles Elimination](https://leetcode.com/problems/shortest-path-in-a-grid-with-obstacles-elimination "网格中的最短路径") | [Go](problems/shortest-path-in-a-grid-with-obstacles-elimination) | Hard |
6671
| <span id="1292">1292</span> | [Maximum Side Length of a Square with Sum Less than or Equal to Threshold](https://leetcode.com/problems/maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold "元素和小于等于阈值的正方形的最大边长") | [Go](problems/maximum-side-length-of-a-square-with-sum-less-than-or-equal-to-threshold) | Medium |
6772
| <span id="1291">1291</span> | [Sequential Digits](https://leetcode.com/problems/sequential-digits "顺次数") | [Go](problems/sequential-digits) | Medium |
@@ -75,7 +80,7 @@ LeetCode Problems' Solutions
7580
| <span id="1283">1283</span> | [Find the Smallest Divisor Given a Threshold](https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold "使结果不超过阈值的最小除数") | [Go](problems/find-the-smallest-divisor-given-a-threshold) | Medium |
7681
| <span id="1282">1282</span> | [Group the People Given the Group Size They Belong To](https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to "用户分组") | [Go](problems/group-the-people-given-the-group-size-they-belong-to) | Medium |
7782
| <span id="1281">1281</span> | [Subtract the Product and Sum of Digits of an Integer](https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer "整数的各位积和之差") | [Go](problems/subtract-the-product-and-sum-of-digits-of-an-integer) | Easy |
78-
| <span id="1280">1280</span> | [Students and Examinations](https://leetcode.com/problems/students-and-examinations) 🔒 | [MySQL](problems/students-and-examinations) | Easy |
83+
| <span id="1280">1280</span> | [Students and Examinations](https://leetcode.com/problems/students-and-examinations"学生们参加各科测试的次数") 🔒 | [MySQL](problems/students-and-examinations) | Easy |
7984
| <span id="1279">1279</span> | [Traffic Light Controlled Intersection](https://leetcode.com/problems/traffic-light-controlled-intersection) 🔒 | [Go](problems/traffic-light-controlled-intersection) | Easy |
8085
| <span id="1278">1278</span> | [Palindrome Partitioning III](https://leetcode.com/problems/palindrome-partitioning-iii "分割回文串 III") | [Go](problems/palindrome-partitioning-iii) | Hard |
8186
| <span id="1277">1277</span> | [Count Square Submatrices with All Ones](https://leetcode.com/problems/count-square-submatrices-with-all-ones "统计全为 1 的正方形子矩阵") | [Go](problems/count-square-submatrices-with-all-ones) | Medium |
@@ -182,7 +187,7 @@ LeetCode Problems' Solutions
182187
| <span id="1176">1176</span> | [Diet Plan Performance](https://leetcode.com/problems/diet-plan-performance "健身计划评估") 🔒 | [Go](problems/diet-plan-performance) | Easy |
183188
| <span id="1175">1175</span> | [Prime Arrangements](https://leetcode.com/problems/prime-arrangements "质数排列") | [Go](problems/prime-arrangements) | Easy |
184189
| <span id="1174">1174</span> | [Immediate Food Delivery II](https://leetcode.com/problems/immediate-food-delivery-ii) 🔒 | [MySQL](problems/immediate-food-delivery-ii) | Medium |
185-
| <span id="1173">1173</span> | [Immediate Food Delivery I](https://leetcode.com/problems/immediate-food-delivery-i) 🔒 | [MySQL](problems/immediate-food-delivery-i) | Easy |
190+
| <span id="1173">1173</span> | [Immediate Food Delivery I](https://leetcode.com/problems/immediate-food-delivery-i"即时食物配送 I") 🔒 | [MySQL](problems/immediate-food-delivery-i) | Easy |
186191
| <span id="1172">1172</span> | [Dinner Plate Stacks](https://leetcode.com/problems/dinner-plate-stacks "餐盘栈") | [Go](problems/dinner-plate-stacks) | Hard |
187192
| <span id="1171">1171</span> | [Remove Zero Sum Consecutive Nodes from Linked List](https://leetcode.com/problems/remove-zero-sum-consecutive-nodes-from-linked-list "从链表中删去总和值为零的连续节点") | [Go](problems/remove-zero-sum-consecutive-nodes-from-linked-list) | Medium |
188193
| <span id="1170">1170</span> | [Compare Strings by Frequency of the Smallest Character](https://leetcode.com/problems/compare-strings-by-frequency-of-the-smallest-character "比较字符串最小字母出现频次") | [Go](problems/compare-strings-by-frequency-of-the-smallest-character) | Easy |

‎internal/leetcode/topic_tag.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ func (tag *TagType) SaveContents() {
4242
if question.TranslatedTitle == "" {
4343
question.TranslatedTitle = question.Title
4444
}
45-
buf.WriteString(fmt.Sprintf(format, question.frontendID(), question.TranslatedTitle, question.TitleSlug, question.IsPaidOnly.Str(), question.TagsStr(), question.Difficulty))
45+
if question.frontendID() > 0 {
46+
buf.WriteString(fmt.Sprintf(format, question.frontendID(), question.TranslatedTitle, question.TitleSlug, question.IsPaidOnly.Str(), question.TagsStr(), question.Difficulty))
47+
}
4648
}
4749
filename := filepath.Join("tag", tag.Slug, "README.md")
4850
filePutContents(filename, buf.Bytes())

‎problems/best-meeting-point/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ Explanation: </strong>Given three people living at <code>(0,0)</code>, <code>(0,
3131
&nbsp; of 2+2+2=6 is minimal. So return 6.</pre>
3232

3333
### Related Topics
34-
[[Sort](../../tag/sort/README.md)]
3534
[[Math](../../tag/math/README.md)]
35+
[[Sort](../../tag/sort/README.md)]
3636

3737
### Similar Questions
3838
1. [Shortest Distance from All Buildings](../shortest-distance-from-all-buildings) (Hard)

‎problems/copy-list-with-random-pointer/README.md

Lines changed: 38 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,53 @@
1515

1616
<p>Return a <a href="https://en.wikipedia.org/wiki/Object_copying#Deep_copy" target="_blank"><strong>deep copy</strong></a> of the list.</p>
1717

18-
<p>&nbsp;</p>
18+
<p>The Linked List is represented in the input/output as a list of <code>n</code> nodes. Each node is represented as a pair of <code>[val, random_index]</code> where:</p>
19+
20+
<ul>
21+
<li><code>val</code>: an integer representing <code>Node.val</code></li>
22+
<li><code>random_index</code>: the index of the node (range from <code>0</code> to <code>n-1</code>) where random pointer points to, or <code>null</code> if it does not point to any node.</li>
23+
</ul>
1924

25+
<p>&nbsp;</p>
2026
<p><strong>Example 1:</strong></p>
27+
<img alt="" src="https://assets.leetcode.com/uploads/2019/12/18/e1.png" style="width: 700px; height: 142px;" />
28+
<pre>
29+
<strong>Input:</strong> head = [[7,null],[13,0],[11,4],[10,2],[1,0]]
30+
<strong>Output:</strong> [[7,null],[13,0],[11,4],[10,2],[1,0]]
31+
</pre>
32+
33+
<p><strong>Example 2:</strong></p>
34+
<img alt="" src="https://assets.leetcode.com/uploads/2019/12/18/e2.png" style="width: 700px; height: 114px;" />
35+
<pre>
36+
<strong>Input:</strong> head = [[1,1],[2,1]]
37+
<strong>Output:</strong> [[1,1],[2,1]]
38+
</pre>
39+
40+
<p><strong>Example 3:</strong></p>
2141

22-
<p><strong><img alt="" src="https://discuss.leetcode.com/uploads/files/1470150906153-2yxeznm.png" style="width: 375px; height: 129px;" /></strong></p>
42+
<p><strong><img alt="" src="https://assets.leetcode.com/uploads/2019/12/18/e3.png" style="width: 700px; height: 122px;" /></strong></p>
2343

2444
<pre>
25-
<strong>Input:
26-
</strong><span id="example-input-1-1">{&quot;$id&quot;:&quot;1&quot;,&quot;next&quot;:{&quot;$id&quot;:&quot;2&quot;,&quot;next&quot;:null,&quot;random&quot;:{&quot;$ref&quot;:&quot;2&quot;},&quot;val&quot;:2},&quot;random&quot;:{&quot;$ref&quot;:&quot;2&quot;},&quot;val&quot;:1}
27-
</span>
28-
<b>Explanation:
29-
</b>Node 1&#39;s value is 1, both of its next and random pointer points to Node 2.
30-
Node 2&#39;s value is 2, its next pointer points to null and its random pointer points to itself.
45+
<strong>Input:</strong> head = [[3,null],[3,0],[3,null]]
46+
<strong>Output:</strong> [[3,null],[3,0],[3,null]]
3147
</pre>
3248

33-
<p>&nbsp;</p>
49+
<p><strong>Example 4:</strong></p>
3450

35-
<p><strong>Note:</strong></p>
51+
<pre>
52+
<strong>Input:</strong> head = []
53+
<strong>Output:</strong> []
54+
<strong>Explanation:</strong> Given linked list is empty (null pointer), so return null.
55+
</pre>
56+
57+
<p>&nbsp;</p>
58+
<p><strong>Constraints:</strong></p>
3659

37-
<ol>
38-
<li>You must return the <strong>copy of the given head</strong>&nbsp;as a reference to the cloned list.</li>
39-
</ol>
60+
<ul>
61+
<li><code>-10000 &lt;= Node.val &lt;= 10000</code></li>
62+
<li><code>Node.random</code> is null or pointing to a node in the linked list.</li>
63+
<li>Number of Nodes will not exceed 1000.</li>
64+
</ul>
4065

4166
### Related Topics
4267
[[Hash Table](../../tag/hash-table/README.md)]
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <openset.wang@gmail.com> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../find-numbers-with-even-number-of-digits "Find Numbers with Even Number of Digits")
9+
10+
[Next >](../maximum-number-of-occurrences-of-a-substring "Maximum Number of Occurrences of a Substring")
11+
12+
## [1296. Divide Array in Sets of K Consecutive Numbers (Medium)](https://leetcode.com/problems/divide-array-in-sets-of-k-consecutive-numbers "划分数组为连续数字的集合")
13+
14+
<p>Given an array of integers&nbsp;<code>nums</code>&nbsp;and a positive integer&nbsp;<code>k</code>, find whether it&#39;s possible to divide this array into&nbsp;sets of <code>k</code> consecutive numbers<br />
15+
Return&nbsp;<code>True</code>&nbsp;if its possible<strong>&nbsp;</strong>otherwise&nbsp;return&nbsp;<code>False</code>.</p>
16+
17+
<p>&nbsp;</p>
18+
<p><strong>Example 1:</strong></p>
19+
20+
<pre>
21+
<strong>Input:</strong> nums = [1,2,3,3,4,4,5,6], k = 4
22+
<strong>Output:</strong> true
23+
<strong>Explanation:</strong> Array can be divided into [1,2,3,4] and [3,4,5,6].
24+
</pre>
25+
26+
<p><strong>Example 2:</strong></p>
27+
28+
<pre>
29+
<strong>Input:</strong> nums = [3,2,1,2,3,4,3,4,5,9,10,11], k = 3
30+
<strong>Output:</strong> true
31+
<strong>Explanation:</strong> Array can be divided into [1,2,3] , [2,3,4] , [3,4,5] and [9,10,11].
32+
</pre>
33+
34+
<p><strong>Example 3:</strong></p>
35+
36+
<pre>
37+
<strong>Input:</strong> nums = [3,3,2,2,1,1], k = 3
38+
<strong>Output:</strong> true
39+
</pre>
40+
41+
<p><strong>Example 4:</strong></p>
42+
43+
<pre>
44+
<strong>Input:</strong> nums = [1,2,3,4], k = 3
45+
<strong>Output:</strong> false
46+
<strong>Explanation:</strong> Each array should be divided in subarrays of size 3.
47+
</pre>
48+
49+
<p>&nbsp;</p>
50+
<p><strong>Constraints:</strong></p>
51+
52+
<ul>
53+
<li><code>1 &lt;= nums.length &lt;= 10^5</code></li>
54+
<li><code>1 &lt;= nums[i] &lt;= 10^9</code></li>
55+
<li><code>1 &lt;= k &lt;= nums.length</code></li>
56+
</ul>
57+
58+
### Related Topics
59+
[[Greedy](../../tag/greedy/README.md)]
60+
[[Array](../../tag/array/README.md)]
61+
62+
### Hints
63+
<details>
64+
<summary>Hint 1</summary>
65+
If the smallest number in the possible-to-split array is V, then numbers V+1, V+2, ... V+k-1 must contain there as well.
66+
</details>
67+
68+
<details>
69+
<summary>Hint 2</summary>
70+
You can iteratively find k sets and remove them from array until it becomes empty.
71+
</details>
72+
73+
<details>
74+
<summary>Hint 3</summary>
75+
Failure to do so would mean that array is unsplittable.
76+
</details>
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <openset.wang@gmail.com> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../weather-type-in-each-country "Weather Type in Each Country")
9+
10+
[Next >](../divide-array-in-sets-of-k-consecutive-numbers "Divide Array in Sets of K Consecutive Numbers")
11+
12+
## [1295. Find Numbers with Even Number of Digits (Easy)](https://leetcode.com/problems/find-numbers-with-even-number-of-digits "统计位数为偶数的数字")
13+
14+
Given an array <code>nums</code> of integers, return how many of them contain an <strong>even number</strong> of digits.
15+
<p>&nbsp;</p>
16+
<p><strong>Example 1:</strong></p>
17+
18+
<pre>
19+
<strong>Input:</strong> nums = [12,345,2,6,7896]
20+
<strong>Output:</strong> 2
21+
<strong>Explanation:
22+
</strong>12 contains 2 digits (even number of digits).&nbsp;
23+
345 contains 3 digits (odd number of digits).&nbsp;
24+
2 contains 1 digit (odd number of digits).&nbsp;
25+
6 contains 1 digit (odd number of digits).&nbsp;
26+
7896 contains 4 digits (even number of digits).&nbsp;
27+
Therefore only 12 and 7896 contain an even number of digits.
28+
</pre>
29+
30+
<p><strong>Example 2:</strong></p>
31+
32+
<pre>
33+
<strong>Input:</strong> nums = [555,901,482,1771]
34+
<strong>Output:</strong> 1
35+
<strong>Explanation: </strong>
36+
Only 1771 contains an even number of digits.
37+
</pre>
38+
39+
<p>&nbsp;</p>
40+
<p><strong>Constraints:</strong></p>
41+
42+
<ul>
43+
<li><code>1 &lt;= nums.length &lt;= 500</code></li>
44+
<li><code>1 &lt;= nums[i] &lt;= 10^5</code></li>
45+
</ul>
46+
47+
### Related Topics
48+
[[Array](../../tag/array/README.md)]
49+
50+
### Hints
51+
<details>
52+
<summary>Hint 1</summary>
53+
How to compute the number of digits of a number ?
54+
</details>
55+
56+
<details>
57+
<summary>Hint 2</summary>
58+
Divide the number by 10 again and again to get the number of digits.
59+
</details>

‎problems/flip-game-ii/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@
2727
Derive your algorithm&#39;s runtime complexity.</p>
2828

2929
### Related Topics
30-
[[Backtracking](../../tag/backtracking/README.md)]
3130
[[Minimax](../../tag/minimax/README.md)]
31+
[[Backtracking](../../tag/backtracking/README.md)]
3232

3333
### Similar Questions
3434
1. [Nim Game](../nim-game) (Easy)

‎problems/immediate-food-delivery-i/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
[Next >](../immediate-food-delivery-ii "Immediate Food Delivery II")
1111

12-
## [1173. Immediate Food Delivery I (Easy)](https://leetcode.com/problems/immediate-food-delivery-i "")
12+
## [1173. Immediate Food Delivery I (Easy)](https://leetcode.com/problems/immediate-food-delivery-i "即时食物配送 I")
1313

1414
<p>Table: <code>Delivery</code></p>
1515

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
<!--|This file generated by command(leetcode description); DO NOT EDIT. |-->
2+
<!--+----------------------------------------------------------------------+-->
3+
<!--|@author openset <openset.wang@gmail.com> |-->
4+
<!--|@link https://github.com/openset |-->
5+
<!--|@home https://github.com/openset/leetcode |-->
6+
<!--+----------------------------------------------------------------------+-->
7+
8+
[< Previous](../maximum-number-of-occurrences-of-a-substring "Maximum Number of Occurrences of a Substring")
9+
10+
Next >
11+
12+
## [1298. Maximum Candies You Can Get from Boxes (Hard)](https://leetcode.com/problems/maximum-candies-you-can-get-from-boxes "你能从盒子里获得的最大糖果数")
13+
14+
<p>Given <code>n</code> boxes, each box is given in the format <code>[status, candies, keys, containedBoxes]</code> where:</p>
15+
16+
<ul>
17+
<li><code>status[i]</code>: an integer which is <strong>1</strong> if&nbsp;<code>box[i]</code> is open and <strong>0</strong> if&nbsp;<code>box[i]</code> is closed.</li>
18+
<li><code>candies[i]</code>:&nbsp;an integer representing the number of candies in <code>box[i]</code>.</li>
19+
<li><code>keys[i]</code>: an array contains the indices of the boxes you can open with the key in <code>box[i]</code>.</li>
20+
<li><code>containedBoxes[i]</code>: an array contains the indices of the boxes found in <code>box[i]</code>.</li>
21+
</ul>
22+
23+
<p>You will start with some boxes given in <code>initialBoxes</code> array. You can take all the candies in any open&nbsp;box and you can use the keys in it to open new boxes and you also can use the boxes you find in it.</p>
24+
25+
<p>Return <em>the maximum number of candies</em> you can get following the rules above.</p>
26+
27+
<p>&nbsp;</p>
28+
<p><strong>Example 1:</strong></p>
29+
30+
<pre>
31+
<strong>Input:</strong> status = [1,0,1,0], candies = [7,5,4,100], keys = [[],[],[1],[]], containedBoxes = [[1,2],[3],[],[]], initialBoxes = [0]
32+
<strong>Output:</strong> 16
33+
<strong>Explanation:</strong> You will be initially given box 0. You will find 7 candies in it and boxes 1 and 2. Box 1 is closed and you don&#39;t have a key for it so you will open box 2. You will find 4 candies and a key to box 1 in box 2.
34+
In box 1, you will find 5 candies and box 3 but you will not find a key to box 3 so box 3 will remain closed.
35+
Total number of candies collected = 7 + 4 + 5 = 16 candy.
36+
</pre>
37+
38+
<p><strong>Example 2:</strong></p>
39+
40+
<pre>
41+
<strong>Input:</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]
42+
<strong>Output:</strong> 6
43+
<strong>Explanation:</strong> You have initially box 0. Opening it you can find boxes 1,2,3,4 and 5 and their keys. The total number of candies will be 6.
44+
</pre>
45+
46+
<p><strong>Example 3:</strong></p>
47+
48+
<pre>
49+
<strong>Input:</strong> status = [1,1,1], candies = [100,1,100], keys = [[],[0,2],[]], containedBoxes = [[],[],[]], initialBoxes = [1]
50+
<strong>Output:</strong> 1
51+
</pre>
52+
53+
<p><strong>Example 4:</strong></p>
54+
55+
<pre>
56+
<strong>Input:</strong> status = [1], candies = [100], keys = [[]], containedBoxes = [[]], initialBoxes = []
57+
<strong>Output:</strong> 0
58+
</pre>
59+
60+
<p><strong>Example 5:</strong></p>
61+
62+
<pre>
63+
<strong>Input:</strong> status = [1,1,1], candies = [2,3,2], keys = [[],[],[]], containedBoxes = [[],[],[]], initialBoxes = [2,1,0]
64+
<strong>Output:</strong> 7
65+
</pre>
66+
67+
<p>&nbsp;</p>
68+
<p><strong>Constraints:</strong></p>
69+
70+
<ul>
71+
<li><code>1 &lt;= status.length &lt;= 1000</code></li>
72+
<li><code>status.length == candies.length == keys.length == containedBoxes.length == n</code></li>
73+
<li><code>status[i]</code> is <code>0</code> or <code>1</code>.</li>
74+
<li><code>1 &lt;= candies[i] &lt;= 1000</code></li>
75+
<li><code><font face="monospace">0 &lt;= keys[i].length &lt;= status.length</font></code></li>
76+
<li><code>0 &lt;= keys[i][j] &lt; status.length</code></li>
77+
<li>All values in <code>keys[i]</code> are unique.</li>
78+
<li><code><font face="monospace">0 &lt;= </font>containedBoxes<font face="monospace">[i].length &lt;= status.length</font></code></li>
79+
<li><code>0 &lt;= containedBoxes[i][j] &lt; status.length</code></li>
80+
<li>All values in <code>containedBoxes[i]</code> are unique.</li>
81+
<li>Each box is contained in one box at most.</li>
82+
<li><code>0 &lt;= initialBoxes.length&nbsp;&lt;= status.length</code></li>
83+
<li><code><font face="monospace">0 &lt;= initialBoxes[i] &lt; status.length</font></code></li>
84+
</ul>
85+
86+
### Related Topics
87+
[[Breadth-first Search](../../tag/breadth-first-search/README.md)]
88+
89+
### Hints
90+
<details>
91+
<summary>Hint 1</summary>
92+
Use Breadth First Search (BFS) to traverse all possible boxes you can open. Only push to the queue the boxes the you have with their keys.
93+
</details>

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /