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 3e47705

Browse files
feat: update lc problems (doocs#3446)
1 parent 9218c40 commit 3e47705

File tree

56 files changed

+858
-286
lines changed

Some content is hidden

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

56 files changed

+858
-286
lines changed

‎solution/0000-0099/0020.Valid Parentheses/README_EN.md‎

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,24 +30,35 @@ tags:
3030
<p>&nbsp;</p>
3131
<p><strong class="example">Example 1:</strong></p>
3232

33-
<pre>
34-
<strong>Input:</strong> s = &quot;()&quot;
35-
<strong>Output:</strong> true
36-
</pre>
33+
<div class="example-block">
34+
<p><strong>Input:</strong> <span class="example-io">s = &quot;()&quot;</span></p>
35+
36+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
37+
</div>
3738

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

40-
<pre>
41-
<strong>Input:</strong> s = &quot;()[]{}&quot;
42-
<strong>Output:</strong> true
43-
</pre>
41+
<div class="example-block">
42+
<p><strong>Input:</strong> <span class="example-io">s = &quot;()[]{}&quot;</span></p>
43+
44+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
45+
</div>
4446

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

47-
<pre>
48-
<strong>Input:</strong> s = &quot;(]&quot;
49-
<strong>Output:</strong> false
50-
</pre>
49+
<div class="example-block">
50+
<p><strong>Input:</strong> <span class="example-io">s = &quot;(]&quot;</span></p>
51+
52+
<p><strong>Output:</strong> <span class="example-io">false</span></p>
53+
</div>
54+
55+
<p><strong class="example">Example 4:</strong></p>
56+
57+
<div class="example-block">
58+
<p><strong>Input:</strong> <span class="example-io">s = &quot;([])&quot;</span></p>
59+
60+
<p><strong>Output:</strong> <span class="example-io">true</span></p>
61+
</div>
5162

5263
<p>&nbsp;</p>
5364
<p><strong>Constraints:</strong></p>

‎solution/0100-0199/0134.Gas Station/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ tags:
2121

2222
<p>You have a car with an unlimited gas tank and it costs <code>cost[i]</code> of gas to travel from the <code>i<sup>th</sup></code> station to its next <code>(i + 1)<sup>th</sup></code> station. You begin the journey with an empty tank at one of the gas stations.</p>
2323

24-
<p>Given two integer arrays <code>gas</code> and <code>cost</code>, return <em>the starting gas station&#39;s index if you can travel around the circuit once in the clockwise direction, otherwise return</em> <code>-1</code>. If there exists a solution, it is <strong>guaranteed</strong> to be <strong>unique</strong></p>
24+
<p>Given two integer arrays <code>gas</code> and <code>cost</code>, return <em>the starting gas station&#39;s index if you can travel around the circuit once in the clockwise direction, otherwise return</em> <code>-1</code>. If there exists a solution, it is <strong>guaranteed</strong> to be <strong>unique</strong>.</p>
2525

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

‎solution/0100-0199/0152.Maximum Product Subarray/README.md‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ tags:
1717

1818
<!-- description:start -->
1919

20-
<p>给你一个整数数组 <code>nums</code>&nbsp;,请你找出数组中乘积最大的非空连续<span data-keyword="subarray-nonempty">子数组</span>(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。</p>
20+
<p>给你一个整数数组 <code>nums</code>&nbsp;,请你找出数组中乘积最大的非空连续<span data-keyword="subarray-nonempty">子数组</span>(该子数组中至少包含一个数字),并返回该子数组所对应的乘积。</p>
2121

2222
<p>测试用例的答案是一个&nbsp;<strong>32-位</strong> 整数。</p>
2323

@@ -45,7 +45,7 @@ tags:
4545
<ul>
4646
<li><code>1 &lt;= nums.length &lt;= 2 * 10<sup>4</sup></code></li>
4747
<li><code>-10 &lt;= nums[i] &lt;= 10</code></li>
48-
<li><code>nums</code> 的任何前缀或后缀的乘积都 <strong>保证</strong>&nbsp;是一个 <strong>32-位</strong> 整数</li>
48+
<li><code>nums</code> 的任何子数组的乘积都 <strong>保证</strong>&nbsp;是一个 <strong>32-位</strong> 整数</li>
4949
</ul>
5050

5151
<!-- description:end -->

‎solution/0100-0199/0152.Maximum Product Subarray/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ tags:
4444
<ul>
4545
<li><code>1 &lt;= nums.length &lt;= 2 * 10<sup>4</sup></code></li>
4646
<li><code>-10 &lt;= nums[i] &lt;= 10</code></li>
47-
<li>The product of any prefix or suffix of <code>nums</code> is <strong>guaranteed</strong> to fit in a <strong>32-bit</strong> integer.</li>
47+
<li>The product of any subarray of <code>nums</code> is <strong>guaranteed</strong> to fit in a <strong>32-bit</strong> integer.</li>
4848
</ul>
4949

5050
<!-- description:end -->

‎solution/0400-0499/0405.Convert a Number to Hexadecimal/README.md‎

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,35 +19,34 @@ tags:
1919

2020
<p>给定一个整数,编写一个算法将这个数转换为十六进制数。对于负整数,我们通常使用&nbsp;<a href="https://baike.baidu.com/item/%E8%A1%A5%E7%A0%81/6854613?fr=aladdin">补码运算</a>&nbsp;方法。</p>
2121

22-
<p><strong>注意:</strong></p>
22+
<p>答案字符串中的所有字母都应该是小写字符,并且除了 0 本身之外,答案中不应该有任何前置零。</p>
2323

24-
<ol>
25-
<li>十六进制中所有字母(<code>a-f</code>)都必须是小写。</li>
26-
<li>十六进制字符串中不能包含多余的前导零。如果要转化的数为0,那么以单个字符<code>&#39;0&#39;</code>来表示;对于其他情况,十六进制字符串中的第一个字符将不会是0字符。&nbsp;</li>
27-
<li>给定的数确保在32位有符号整数范围内。</li>
28-
<li><strong>不能使用任何由库提供的将数字直接转换或格式化为十六进制的方法。</strong></li>
29-
</ol>
24+
<p><strong>注意: </strong>不允许使用任何由库提供的将数字直接转换或格式化为十六进制的方法来解决这个问题。</p>
3025

31-
<p><strong>示例 1:</strong></p>
26+
<p>&nbsp;</p>
3227

33-
<pre>
34-
输入:
35-
26
28+
<p><strong class="example">示例 1:</strong></p>
3629

37-
输出:
38-
&quot;1a&quot;
30+
<pre>
31+
<b>输入:</b>num = 26
32+
<b>输出:</b>"1a"
3933
</pre>
4034

41-
<p><strong>示例 2:</strong></p>
35+
<p><strongclass="example">示例 2:</strong></p>
4236

4337
<pre>
44-
输入:
45-
-1
46-
47-
输出:
48-
&quot;ffffffff&quot;
38+
<b>输入:</b>num = -1
39+
<b>输出:</b>"ffffffff"
4940
</pre>
5041

42+
<p>&nbsp;</p>
43+
44+
<p><strong>提示:</strong></p>
45+
46+
<ul>
47+
<li><code>-2<sup>31</sup> &lt;= num &lt;= 2<sup>31</sup> - 1</code></li>
48+
</ul>
49+
5150
<!-- description:end -->
5251

5352
## 解法

‎solution/0400-0499/0405.Convert a Number to Hexadecimal/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ tags:
1717

1818
<!-- description:start -->
1919

20-
<p>Given an integer <code>num</code>, return <em>a string representing its hexadecimal representation</em>. For negative integers, <a href="https://en.wikipedia.org/wiki/Two%27s_complement" target="_blank">two&rsquo;s complement</a> method is used.</p>
20+
<p>Given a 32-bit integer <code>num</code>, return <em>a string representing its hexadecimal representation</em>. For negative integers, <a href="https://en.wikipedia.org/wiki/Two%27s_complement" target="_blank">two&rsquo;s complement</a> method is used.</p>
2121

2222
<p>All the letters in the answer string should be lowercase characters, and there should not be any leading zeros in the answer except for the zero itself.</p>
2323

‎solution/0400-0499/0442.Find All Duplicates in an Array/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tags:
1919

2020
<p>给你一个长度为 <code>n</code> 的整数数组 <code>nums</code> ,其中 <code>nums</code> 的所有整数都在范围 <code>[1, n]</code> 内,且每个整数出现 <strong>一次</strong> 或 <strong>两次</strong> 。请你找出所有出现 <strong>两次</strong> 的整数,并以数组形式返回。</p>
2121

22-
<p>你必须设计并实现一个时间复杂度为 <code>O(n)</code> 且仅使用常量额外空间的算法解决此问题。</p>
22+
<p>你必须设计并实现一个时间复杂度为 <code>O(n)</code> 且仅使用常量额外空间(不包括存储输出所需的空间)的算法解决此问题。</p>
2323

2424
<p>&nbsp;</p>
2525

‎solution/0400-0499/0442.Find All Duplicates in an Array/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tags:
1919

2020
<p>Given an integer array <code>nums</code> of length <code>n</code> where all the integers of <code>nums</code> are in the range <code>[1, n]</code> and each integer appears <strong>once</strong> or <strong>twice</strong>, return <em>an array of all the integers that appears <strong>twice</strong></em>.</p>
2121

22-
<p>You must write an algorithm that runs in&nbsp;<code>O(n)</code>&nbsp;time and uses only constant extra space.</p>
22+
<p>You must write an algorithm that runs in<code>O(n)</code>time and uses only <em>constant</em> auxiliary space, excluding the space needed to store the output</p>
2323

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

‎solution/0400-0499/0451.Sort Characters By Frequency/README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tags:
2727

2828
<p>&nbsp;</p>
2929

30-
<p><strong>示例 1:</strong></p>
30+
<p><strongclass="example">示例 1:</strong></p>
3131

3232
<pre>
3333
<strong>输入: </strong>s = "tree"
@@ -36,7 +36,7 @@ tags:
3636
因此'e'必须出现在'r'和't'之前。此外,"eetr"也是一个有效的答案。
3737
</pre>
3838

39-
<p><strong>示例 2:</strong></p>
39+
<p><strongclass="example">示例 2:</strong></p>
4040

4141
<pre>
4242
<strong>输入: </strong>s = "cccaaa"
@@ -45,7 +45,7 @@ tags:
4545
注意"cacaca"是不正确的,因为相同的字母必须放在一起。
4646
</pre>
4747

48-
<p><strong>示例 3:</strong></p>
48+
<p><strongclass="example">示例 3:</strong></p>
4949

5050
<pre>
5151
<strong>输入: </strong>s = "Aabb"

‎solution/0400-0499/0455.Assign Cookies/README.md‎

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,41 +21,45 @@ tags:
2121

2222
<p>假设你是一位很棒的家长,想要给你的孩子们一些小饼干。但是,每个孩子最多只能给一块饼干。</p>
2323

24-
<p>对每个孩子 <code>i</code>,都有一个胃口值<code>g[i]</code><sub>,</sub>这是能让孩子们满足胃口的饼干的最小尺寸;并且每块饼干 <code>j</code>,都有一个尺寸 <code>s[j]</code><sub></sub>。如果 <code>s[j] >= g[i]</code>,我们可以将这个饼干 <code>j</code> 分配给孩子 <code>i</code> ,这个孩子会得到满足。你的目标是尽可能满足越多数量的孩子,并输出这个最大数值。</p>
25-
24+
<p>对每个孩子 <code>i</code>,都有一个胃口值&nbsp;<code>g[i]</code><sub>,</sub>这是能让孩子们满足胃口的饼干的最小尺寸;并且每块饼干 <code>j</code>,都有一个尺寸 <code>s[j]</code><sub>&nbsp;</sub>。如果 <code>s[j]&nbsp;&gt;= g[i]</code>,我们可以将这个饼干 <code>j</code> 分配给孩子 <code>i</code> ,这个孩子会得到满足。你的目标是尽可能满足越多数量的孩子,并输出这个最大数值。</p>
25+
&nbsp;
2626

27-
<p><strong>示例1:</strong></p>
27+
<p><strong>示例&nbsp;1:</strong></p>
2828

2929
<pre>
3030
<strong>输入:</strong> g = [1,2,3], s = [1,1]
3131
<strong>输出:</strong> 1
3232
<strong>解释:</strong>
33-
你有三个孩子和两块小饼干,3个孩子的胃口值分别是:1,2,3。
34-
虽然你有两块小饼干,由于他们的尺寸都是1,你只能让胃口值是1的孩子满足
35-
所以你应该输出1
33+
你有三个孩子和两块小饼干,3 个孩子的胃口值分别是:1,2,3。
34+
虽然你有两块小饼干,由于他们的尺寸都是 1,你只能让胃口值是 1 的孩子满足
35+
所以你应该输出 1
3636
</pre>
3737

38-
<p><strong>示例2:</strong></p>
38+
<p><strong>示例&nbsp;2:</strong></p>
3939

4040
<pre>
4141
<strong>输入:</strong> g = [1,2], s = [1,2,3]
4242
<strong>输出:</strong> 2
4343
<strong>解释:</strong>
44-
你有两个孩子和三块小饼干,2个孩子的胃口值分别是1,2。
44+
你有两个孩子和三块小饼干,2 个孩子的胃口值分别是 1,2。
4545
你拥有的饼干数量和尺寸都足以让所有孩子满足。
46-
所以你应该输出2.
46+
所以你应该输出 2。
4747
</pre>
4848

49-
<p></p>
49+
<p>&nbsp;</p>
5050

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

5353
<ul>
54-
<li><code>1 <= g.length <= 3 * 10<sup>4</sup></code></li>
55-
<li><code>0 <= s.length <= 3 * 10<sup>4</sup></code></li>
56-
<li><code>1 <= g[i], s[j] <= 2<sup>31</sup> - 1</code></li>
54+
<li><code>1 &lt;= g.length &lt;= 3 * 10<sup>4</sup></code></li>
55+
<li><code>0 &lt;= s.length &lt;= 3 * 10<sup>4</sup></code></li>
56+
<li><code>1 &lt;= g[i], s[j] &lt;=&nbsp;2<sup>31</sup> - 1</code></li>
5757
</ul>
5858

59+
<p>&nbsp;</p>
60+
61+
<p><strong>注意:</strong>本题与&nbsp;<a href="https://leetcode.cn/problems/maximum-matching-of-players-with-trainers/">2410. 运动员和训练师的最大匹配数</a>&nbsp;题相同。</p>
62+
5963
<!-- description:end -->
6064

6165
## 解法

0 commit comments

Comments
(0)

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