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 4e6383b

Browse files
author
Shuo
authored
Merge pull request #812 from openset/develop
A: new
2 parents 6ccc864 + 8e5e962 commit 4e6383b

File tree

73 files changed

+1250
-370
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+1250
-370
lines changed

‎README.md‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ LeetCode Problems' Solutions
7070

7171
| # | Title | Solution | Difficulty |
7272
| :-: | - | - | :-: |
73+
| <span id="1579">1579</span> | [Remove Max Number of Edges to Keep Graph Fully Traversable](https://leetcode.com/problems/remove-max-number-of-edges-to-keep-graph-fully-traversable "保证图可完全遍历") | [Go](problems/remove-max-number-of-edges-to-keep-graph-fully-traversable) | Hard |
74+
| <span id="1578">1578</span> | [Minimum Deletion Cost to Avoid Repeating Letters](https://leetcode.com/problems/minimum-deletion-cost-to-avoid-repeating-letters "避免重复字母的最小删除成本") | [Go](problems/minimum-deletion-cost-to-avoid-repeating-letters) | Medium |
75+
| <span id="1577">1577</span> | [Number of Ways Where Square of Number Is Equal to Product of Two Numbers](https://leetcode.com/problems/number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers "数的平方等于两数乘积的方法数") | [Go](problems/number-of-ways-where-square-of-number-is-equal-to-product-of-two-numbers) | Medium |
76+
| <span id="1576">1576</span> | [Replace All ?'s to Avoid Consecutive Repeating Characters](https://leetcode.com/problems/replace-all-s-to-avoid-consecutive-repeating-characters "替换所有的问号") | [Go](problems/replace-all-s-to-avoid-consecutive-repeating-characters) | Easy |
77+
| <span id="1575">1575</span> | [Count All Possible Routes](https://leetcode.com/problems/count-all-possible-routes "统计所有可行路径") | [Go](problems/count-all-possible-routes) | Hard |
78+
| <span id="1574">1574</span> | [Shortest Subarray to be Removed to Make Array Sorted](https://leetcode.com/problems/shortest-subarray-to-be-removed-to-make-array-sorted "删除最短的子数组使剩余数组有序") | [Go](problems/shortest-subarray-to-be-removed-to-make-array-sorted) | Medium |
79+
| <span id="1573">1573</span> | [Number of Ways to Split a String](https://leetcode.com/problems/number-of-ways-to-split-a-string "分割字符串的方案数") | [Go](problems/number-of-ways-to-split-a-string) | Medium |
80+
| <span id="1572">1572</span> | [Matrix Diagonal Sum](https://leetcode.com/problems/matrix-diagonal-sum "矩阵对角线元素的和") | [Go](problems/matrix-diagonal-sum) | Easy |
81+
| <span id="1571">1571</span> | [Warehouse Manager](https://leetcode.com/problems/warehouse-manager) 🔒 | [MySQL](problems/warehouse-manager) | Easy |
82+
| <span id="1570">1570</span> | [Dot Product of Two Sparse Vectors](https://leetcode.com/problems/dot-product-of-two-sparse-vectors) 🔒 | [Go](problems/dot-product-of-two-sparse-vectors) | Medium |
7383
| <span id="1569">1569</span> | [Number of Ways to Reorder Array to Get Same BST](https://leetcode.com/problems/number-of-ways-to-reorder-array-to-get-same-bst "将子数组重新排序得到同一个二叉查找树的方案数") | [Go](problems/number-of-ways-to-reorder-array-to-get-same-bst) | Hard |
7484
| <span id="1568">1568</span> | [Minimum Number of Days to Disconnect Island](https://leetcode.com/problems/minimum-number-of-days-to-disconnect-island "使陆地分离的最少天数") | [Go](problems/minimum-number-of-days-to-disconnect-island) | Hard |
7585
| <span id="1567">1567</span> | [Maximum Length of Subarray With Positive Product](https://leetcode.com/problems/maximum-length-of-subarray-with-positive-product "乘积为正数的最长子数组长度") | [Go](problems/maximum-length-of-subarray-with-positive-product) | Medium |

‎problems/3sum/README.md‎

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,26 @@
1313

1414
<p>Given an array <code>nums</code> of <em>n</em> integers, are there elements <em>a</em>, <em>b</em>, <em>c</em> in <code>nums</code> such that <em>a</em> + <em>b</em> + <em>c</em> = 0? Find all unique triplets in the array which gives the sum of zero.</p>
1515

16-
<p><strong>Note:</strong></p>
17-
18-
<p>The solution set must not contain duplicate triplets.</p>
19-
20-
<p><strong>Example:</strong></p>
21-
22-
<pre>
23-
Given array nums = [-1, 0, 1, 2, -1, -4],
24-
25-
A solution set is:
26-
[
27-
[-1, 0, 1],
28-
[-1, -1, 2]
29-
]
16+
<p>Notice that the solution set must not contain duplicate triplets.</p>
17+
18+
<p>&nbsp;</p>
19+
<p><strong>Example 1:</strong></p>
20+
<pre><strong>Input:</strong> nums = [-1,0,1,2,-1,-4]
21+
<strong>Output:</strong> [[-1,-1,2],[-1,0,1]]
22+
</pre><p><strong>Example 2:</strong></p>
23+
<pre><strong>Input:</strong> nums = []
24+
<strong>Output:</strong> []
25+
</pre><p><strong>Example 3:</strong></p>
26+
<pre><strong>Input:</strong> nums = [0]
27+
<strong>Output:</strong> []
3028
</pre>
29+
<p>&nbsp;</p>
30+
<p><strong>Constraints:</strong></p>
31+
32+
<ul>
33+
<li><code>0 &lt;= nums.length &lt;= 3000</code></li>
34+
<li><code>-10<sup>5</sup> &lt;= nums[i] &lt;= 10<sup>5</sup></code></li>
35+
</ul>
3136

3237
### Related Topics
3338
[[Array](../../tag/array/README.md)]

‎problems/contains-duplicate-iii/README.md‎

Lines changed: 18 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,32 +13,26 @@
1313

1414
<p>Given an array of integers, find out whether there are two distinct indices <i>i</i> and <i>j</i> in the array such that the <b>absolute</b> difference between <b>nums[i]</b> and <b>nums[j]</b> is at most <i>t</i> and the <b>absolute</b> difference between <i>i</i> and <i>j</i> is at most <i>k</i>.</p>
1515

16-
<div>
16+
<p>&nbsp;</p>
1717
<p><strong>Example 1:</strong></p>
18-
19-
<pre>
20-
<strong>Input: </strong>nums = <span id="example-input-1-1">[1,2,3,1]</span>, k = <span id="example-input-1-2">3</span>, t = <span id="example-input-1-3">0</span>
21-
<strong>Output: </strong><span id="example-output-1">true</span>
22-
</pre>
23-
24-
<div>
25-
<p><strong>Example 2:</strong></p>
26-
27-
<pre>
28-
<strong>Input: </strong>nums = <span id="example-input-2-1">[1,0,1,1]</span>, k = <span id="example-input-2-2">1</span>, t = <span id="example-input-2-3">2</span>
29-
<strong>Output: </strong><span id="example-output-2">true</span>
30-
</pre>
31-
32-
<div>
33-
<p><strong>Example 3:</strong></p>
34-
35-
<pre>
36-
<strong>Input: </strong>nums = <span id="example-input-3-1">[1,5,9,1,5,9]</span>, k = <span id="example-input-3-2">2</span>, t = <span id="example-input-3-3">3</span>
37-
<strong>Output: </strong><span id="example-output-3">false</span>
18+
<pre><strong>Input:</strong> nums = [1,2,3,1], k = 3, t = 0
19+
<strong>Output:</strong> true
20+
</pre><p><strong>Example 2:</strong></p>
21+
<pre><strong>Input:</strong> nums = [1,0,1,1], k = 1, t = 2
22+
<strong>Output:</strong> true
23+
</pre><p><strong>Example 3:</strong></p>
24+
<pre><strong>Input:</strong> nums = [1,5,9,1,5,9], k = 2, t = 3
25+
<strong>Output:</strong> false
3826
</pre>
39-
</div>
40-
</div>
41-
</div>
27+
<p>&nbsp;</p>
28+
<p><strong>Constraints:</strong></p>
29+
30+
<ul>
31+
<li><code>0 &lt;= nums.length &lt;= 2 * 10<sup>4</sup></code></li>
32+
<li><code>-2<sup>31</sup> &lt;= nums[i]&nbsp;&lt;= 2<sup>31</sup> - 1</code></li>
33+
<li><code>0 &lt;= k &lt;= 10<sup>4</sup></code></li>
34+
<li><code>0 &lt;= t &lt;= 2<sup>31</sup> - 1</code></li>
35+
</ul>
4236

4337
### Related Topics
4438
[[Sort](../../tag/sort/README.md)]

‎problems/convert-sorted-list-to-binary-search-tree/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949
<p><strong>Constraints:</strong></p>
5050

5151
<ul>
52-
<li>The numner of nodes in <code>head</code> is in the range <code>[0, 2 * 10^4]</code>.</li>
52+
<li>The number of nodes in <code>head</code> is in the range <code>[0, 2 * 10<sup>4</sup>]</code>.</li>
5353
<li><code>-10^5 &lt;= Node.val &lt;= 10^5</code></li>
5454
</ul>
5555

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
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](../shortest-subarray-to-be-removed-to-make-array-sorted "Shortest Subarray to be Removed to Make Array Sorted")
9+
10+
[Next >](../replace-all-s-to-avoid-consecutive-repeating-characters "Replace All ?'s to Avoid Consecutive Repeating Characters")
11+
12+
## [1575. Count All Possible Routes (Hard)](https://leetcode.com/problems/count-all-possible-routes "统计所有可行路径")
13+
14+
<p>You are given an array of <strong>distinct</strong> positive integers locations&nbsp;where <code>locations[i]</code> represents the position of city <code>i</code>. You are also given&nbsp;integers&nbsp;<code>start</code>,&nbsp;<code>finish</code>&nbsp;and&nbsp;<code>fuel</code>&nbsp;representing the starting city, ending city, and the initial amount of fuel you have, respectively.</p>
15+
16+
<p>At each step, if you are at city&nbsp;<code>i</code>, you can pick any city&nbsp;<code>j</code>&nbsp;such that <code>j != i</code>&nbsp;and&nbsp;<code>0 &lt;= j &lt; locations.length</code>&nbsp;and move to city <code>j</code>.&nbsp;Moving from city <code>i</code> to city <code>j</code> reduces the amount of fuel you have by&nbsp;<code>|locations[i] - locations[j]|</code>.&nbsp;Please notice that <code>|x|</code>&nbsp;denotes the absolute value of <code>x</code>.</p>
17+
18+
<p>Notice that&nbsp;<code>fuel</code>&nbsp;<strong>cannot</strong> become negative at any point in time, and that you are <strong>allowed</strong> to visit any city more than once (including <code>start</code>&nbsp;and&nbsp;<code>finish</code>).</p>
19+
20+
<p>Return <em>the count of all possible routes from&nbsp;</em><code>start</code>&nbsp;<em>to</em>&nbsp;<code>finish</code>.</p>
21+
22+
<p>Since the answer&nbsp;may be too large,&nbsp;return it modulo&nbsp;<code>10^9 + 7</code>.</p>
23+
24+
<p>&nbsp;</p>
25+
<p><strong>Example 1:</strong></p>
26+
27+
<pre>
28+
<strong>Input:</strong> locations = [2,3,6,8,4], start = 1, finish = 3, fuel = 5
29+
<strong>Output:</strong> 4
30+
<strong>Explanation:</strong>&nbsp;The following are all possible routes, each uses 5 units of fuel:
31+
1 -&gt; 3
32+
1 -&gt; 2 -&gt; 3
33+
1 -&gt; 4 -&gt; 3
34+
1 -&gt; 4 -&gt; 2 -&gt; 3
35+
</pre>
36+
37+
<p><strong>Example 2:</strong></p>
38+
39+
<pre>
40+
<strong>Input:</strong> locations = [4,3,1], start = 1, finish = 0, fuel = 6
41+
<strong>Output:</strong> 5
42+
<strong>Explanation: </strong>The following are all possible routes:
43+
1 -&gt; 0, used fuel = 1
44+
1 -&gt; 2 -&gt; 0, used fuel = 5
45+
1 -&gt; 2 -&gt; 1 -&gt; 0, used fuel = 5
46+
1 -&gt; 0 -&gt; 1 -&gt; 0, used fuel = 3
47+
1 -&gt; 0 -&gt; 1 -&gt; 0 -&gt; 1 -&gt; 0, used fuel = 5
48+
</pre>
49+
50+
<p><strong>Example 3:</strong></p>
51+
52+
<pre>
53+
<strong>Input:</strong> locations = [5,2,1], start = 0, finish = 2, fuel = 3
54+
<strong>Output:</strong> 0
55+
<b>Explanation: </b>It&#39;s impossible to get from 0 to 2 using only 3 units of fuel since the shortest route needs 4 units of fuel.</pre>
56+
57+
<p><strong>Example 4:</strong></p>
58+
59+
<pre>
60+
<strong>Input:</strong> locations = [2,1,5], start = 0, finish = 0, fuel = 3
61+
<strong>Output:</strong> 2
62+
<strong>Explanation:</strong>&nbsp;There are two possible routes, 0 and 0 -&gt; 1 -&gt; 0.</pre>
63+
64+
<p><strong>Example 5:</strong></p>
65+
66+
<pre>
67+
<strong>Input:</strong> locations = [1,2,3], start = 0, finish = 2, fuel = 40
68+
<strong>Output:</strong> 615088286
69+
<strong>Explanation: </strong>The total number of possible routes is 2615088300. Taking this number modulo 10^9 + 7 gives us 615088286.
70+
</pre>
71+
72+
<p>&nbsp;</p>
73+
<p><strong>Constraints:</strong></p>
74+
75+
<ul>
76+
<li><code>2 &lt;= locations.length &lt;= 100</code></li>
77+
<li><code>1 &lt;= locations[i] &lt;= 10^9</code></li>
78+
<li>All integers in&nbsp;<code>locations</code>&nbsp;are&nbsp;<strong>distinct</strong>.</li>
79+
<li><code>0 &lt;= start, finish &lt;&nbsp;locations.length</code></li>
80+
<li><code><font face="monospace">1 &lt;= fuel &lt;= 200</font></code></li>
81+
</ul>
82+
83+
### Related Topics
84+
[[Dynamic Programming](../../tag/dynamic-programming/README.md)]
85+
86+
### Hints
87+
<details>
88+
<summary>Hint 1</summary>
89+
Use dynamic programming to solve this problem with each state defined by the city index and fuel left.
90+
</details>
91+
92+
<details>
93+
<summary>Hint 2</summary>
94+
Since the array contains distinct integers fuel will always be spent in each move and so there can be no cycles.
95+
</details>

‎problems/delete-node-in-a-bst/README.md‎

Lines changed: 35 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -13,45 +13,52 @@
1313

1414
<p>Given a root node reference of a BST and a key, delete the node with the given key in the BST. Return the root node reference (possibly updated) of the BST.</p>
1515

16-
<p>Basically, the deletion can be divided into two stages:
16+
<p>Basically, the deletion can be divided into two stages:</p>
17+
1718
<ol>
18-
<li>Search for a node to remove.</li>
19-
<li>If the node is found, delete the node.</li>
19+
<li>Search for a node to remove.</li>
20+
<li>If the node is found, delete the node.</li>
2021
</ol>
21-
</p>
2222

23-
<p><b>Note:</b> Time complexity should be O(height of tree).</p>
23+
<p><b>Follow up:</b>&nbsp;Can you solve it with time complexity <code>O(height of tree)</code>?</p>
2424

25-
<p><b>Example:</b>
25+
<p>&nbsp;</p>
26+
<p><strong>Example 1:</strong></p>
27+
<img alt="" src="https://assets.leetcode.com/uploads/2020/09/04/del_node_1.jpg" style="width: 800px; height: 214px;" />
2628
<pre>
27-
root = [5,3,6,2,4,null,7]
28-
key = 3
29+
<strong>Input:</strong> root = [5,3,6,2,4,null,7], key = 3
30+
<strong>Output:</strong> [5,4,6,2,null,null,7]
31+
<strong>Explanation:</strong> Given key to delete is 3. So we find the node with value 3 and delete it.
32+
One valid answer is [5,4,6,2,null,null,7], shown in the above BST.
33+
Please notice that another valid answer is [5,2,6,null,4,null,7] and it&#39;s also accepted.
34+
<img alt="" src="https://assets.leetcode.com/uploads/2020/09/04/del_node_supp.jpg" style="width: 350px; height: 255px;" />
35+
</pre>
2936

30-
5
31-
/ \
32-
3 6
33-
/ \ \
34-
2 4 7
37+
<p><strong>Example 2:</strong></p>
3538

36-
Given key to delete is 3. So we find the node with value 3 and delete it.
39+
<pre>
40+
<strong>Input:</strong> root = [5,3,6,2,4,null,7], key = 0
41+
<strong>Output:</strong> [5,3,6,2,4,null,7]
42+
<strong>Explanation:</strong> The tree does not contain a node with value = 0.
43+
</pre>
3744

38-
One valid answer is [5,4,6,2,null,null,7], shown in the following BST.
45+
<p><strong>Example 3:</strong></p>
3946

40-
5
41-
/ \
42-
4 6
43-
/ \
44-
2 7
47+
<pre>
48+
<strong>Input:</strong> root = [], key = 0
49+
<strong>Output:</strong> []
50+
</pre>
4551

46-
Another valid answer is [5,2,6,null,4,null,7].
52+
<p>&nbsp;</p>
53+
<p><strong>Constraints:</strong></p>
4754

48-
5
49-
/ \
50-
2 6
51-
\ \
52-
4 7
53-
</pre>
54-
</p>
55+
<ul>
56+
<li>The number of nodes in the tree is in the range <code>[0, 10<sup>4</sup>]</code>.</li>
57+
<li><code>-10<sup>5</sup> &lt;= Node.val &lt;= 10<sup>5</sup></code></li>
58+
<li>Each node has a <strong>unique</strong> value.</li>
59+
<li><code>root</code> is a valid binary search tree.</li>
60+
<li><code>-10<sup>5</sup> &lt;= key &lt;= 10<sup>5</sup></code></li>
61+
</ul>
5562

5663
### Related Topics
5764
[[Tree](../../tag/tree/README.md)]

‎problems/delete-node-in-a-linked-list/README.md‎

Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,39 +11,56 @@
1111

1212
## [237. Delete Node in a Linked List (Easy)](https://leetcode.com/problems/delete-node-in-a-linked-list "删除链表中的节点")
1313

14-
<p>Write a function to delete a node (except the tail) in a singlylinked list, given only access to that node.</p>
14+
<p>Write a function to <strong>delete a node</strong> in a singly-linked list. You will <strong>not</strong> be given access to the <code>head</code> of the list, instead you will be given access to <strong>the node to be deleted</strong> directly.</p>
1515

16-
<p>Given linked list --&nbsp;head =&nbsp;[4,5,1,9], which looks like following:</p>
17-
18-
<p><img alt="" src="https://assets.leetcode.com/uploads/2018/12/28/237_example.png" style="margin-top: 5px; margin-bottom: 5px; width: 300px; height: 49px;" /></p>
16+
<p>It is <strong>guaranteed</strong> that the node to be deleted is <strong>not a tail node</strong> in the list.</p>
1917

2018
<p>&nbsp;</p>
21-
2219
<p><strong>Example 1:</strong></p>
23-
20+
<imgalt=""src="https://assets.leetcode.com/uploads/2020/09/01/node1.jpg"style="width: 450px; height: 322px;" />
2421
<pre>
2522
<strong>Input:</strong> head = [4,5,1,9], node = 5
2623
<strong>Output:</strong> [4,1,9]
2724
<strong>Explanation: </strong>You are given the second node with value 5, the linked list should become 4 -&gt; 1 -&gt; 9 after calling your function.
2825
</pre>
2926

3027
<p><strong>Example 2:</strong></p>
31-
28+
<imgalt=""src="https://assets.leetcode.com/uploads/2020/09/01/node2.jpg"style="width: 450px; height: 354px;" />
3229
<pre>
3330
<strong>Input:</strong> head = [4,5,1,9], node = 1
3431
<strong>Output:</strong> [4,5,9]
3532
<strong>Explanation: </strong>You are given the third node with value 1, the linked list should become 4 -&gt; 5 -&gt; 9 after calling your function.
3633
</pre>
3734

38-
<p>&nbsp;</p>
35+
<p><strong>Example 3:</strong></p>
36+
37+
<pre>
38+
<strong>Input:</strong> head = [1,2,3,4], node = 3
39+
<strong>Output:</strong> [1,2,4]
40+
</pre>
41+
42+
<p><strong>Example 4:</strong></p>
3943

40-
<p><strong>Note:</strong></p>
44+
<pre>
45+
<strong>Input:</strong> head = [0,1], node = 0
46+
<strong>Output:</strong> [1]
47+
</pre>
48+
49+
<p><strong>Example 5:</strong></p>
50+
51+
<pre>
52+
<strong>Input:</strong> head = [-3,5,-99], node = -3
53+
<strong>Output:</strong> [5,-99]
54+
</pre>
55+
56+
<p>&nbsp;</p>
57+
<p><strong>Constraints:</strong></p>
4158

4259
<ul>
43-
<li>The linked list will have at least two elements.</li>
44-
<li>All of the nodes&#39; values will be unique.</li>
45-
<li>The given node&nbsp;will not be the tail and it will always be a valid node of the linked list.</li>
46-
<li>Do not return anything from your function.</li>
60+
<li>The number of the nodes in the given list is in the range <code>[2, 1000]</code>.</li>
61+
<li><code>-1000 &lt;= Node.val &lt;= 1000</code></li>
62+
<li>The value of each node in the list is <strong>unique</strong>.</li>
63+
<li>The <code>node</code> to be deleted is <strong>in the list</strong> and is <strong>not a tail</strong> node</li>
4764
</ul>
4865

4966
### Related Topics

‎problems/design-add-and-search-words-data-structure/README.md‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,14 +11,14 @@
1111

1212
## [211. Design Add and Search Words Data Structure (Medium)](https://leetcode.com/problems/design-add-and-search-words-data-structure "添加与搜索单词 - 数据结构设计")
1313

14-
<p>You should design a data structure that supports adding new words and finding if a string matches any previously added string.</p>
14+
<p>Design a data structure that supports adding new words and finding if a string matches any previously added string.</p>
1515

1616
<p>Implement the <code>WordDictionary</code> class:</p>
1717

1818
<ul>
1919
<li><code>WordDictionary()</code>&nbsp;Initializes the object.</li>
20-
<li><code>void addWord(word)</code> adds <code>word</code> to the data structure, it can be matched later.</li>
21-
<li><code>bool search(word)</code>&nbsp;returns <code>true</code> if there is any string in the data structure that matches <code>word</code>&nbsp;or <code>false</code> otherwise. <code>word</code> may contain dots <code>&#39;.&#39;</code> where dots can be matched with any letter.</li>
20+
<li><code>void addWord(word)</code> Adds <code>word</code> to the data structure, it can be matched later.</li>
21+
<li><code>bool search(word)</code>&nbsp;Returns <code>true</code> if there is any string in the data structure that matches <code>word</code>&nbsp;or <code>false</code> otherwise. <code>word</code> may contain dots <code>&#39;.&#39;</code> where dots can be matched with any letter.</li>
2222
</ul>
2323

2424
<p>&nbsp;</p>
@@ -48,8 +48,8 @@ wordDictionary.search(&quot;b..&quot;); // return True
4848
<ul>
4949
<li><code>1 &lt;= word.length &lt;= 500</code></li>
5050
<li><code>word</code> in <code>addWord</code> consists lower-case English letters.</li>
51-
<li><code>word</code> in <code>search</code> consist of&nbsp; &#39;.&#39; or lower-case English letters.</li>
52-
<li>At most <code>50000</code>&nbsp;calls will be made to <code>addWord</code>&nbsp;and <code>search</code>.</li>
51+
<li><code>word</code> in <code>search</code> consist of&nbsp; <code>&#39;.&#39;</code> or lower-case English letters.</li>
52+
<li>At most <code>50000</code>&nbsp;calls will be made to <code>addWord</code>&nbsp;and <code>search</code>.</li>
5353
</ul>
5454

5555
### Related Topics

0 commit comments

Comments
(0)

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