Skip to content

Commit f44ad30

Browse files
committed
feat: update lc problems
1 parent c1de100 commit f44ad30

File tree

138 files changed

+465
-394
lines changed

Some content is hidden

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

138 files changed

+465
-394
lines changed

solution/0000-0099/0013.Roman to Integer/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ C 100
1616
D 500
1717
M 1000</pre>
1818

19-
<p>For example,&nbsp;<code>2</code> is written as <code>II</code>&nbsp;in Roman numeral, just two one&#39;s added together. <code>12</code> is written as&nbsp;<code>XII</code>, which is simply <code>X + II</code>. The number <code>27</code> is written as <code>XXVII</code>, which is <code>XX + V + II</code>.</p>
19+
<p>For example,&nbsp;<code>2</code> is written as <code>II</code>&nbsp;in Roman numeral, just two ones added together. <code>12</code> is written as&nbsp;<code>XII</code>, which is simply <code>X + II</code>. The number <code>27</code> is written as <code>XXVII</code>, which is <code>XX + V + II</code>.</p>
2020

2121
<p>Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not <code>IIII</code>. Instead, the number four is written as <code>IV</code>. Because the one is before the five we subtract it making four. The same principle applies to the number nine, which is written as <code>IX</code>. There are six instances where subtraction is used:</p>
2222

solution/0000-0099/0014.Longest Common Prefix/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<ul>
3131
<li><code>1 &lt;= strs.length &lt;= 200</code></li>
3232
<li><code>0 &lt;= strs[i].length &lt;= 200</code></li>
33-
<li><code>strs[i]</code> consists of only lower-case English letters.</li>
33+
<li><code>strs[i]</code> consists of only lowercase English letters.</li>
3434
</ul>
3535

3636
## Solutions

solution/0000-0099/0017.Letter Combinations of a Phone Number/README_EN.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,8 @@
66

77
<p>Given a string containing digits from <code>2-9</code> inclusive, return all possible letter combinations that the number could represent. Return the answer in <strong>any order</strong>.</p>
88

9-
<p>A mapping of digit to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.</p>
10-
11-
<p><img src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0000-0099/0017.Letter%20Combinations%20of%20a%20Phone%20Number/images/200px-Telephone-keypad2.svg.png" style="width: 200px; height: 162px;" /></p>
12-
9+
<p>A mapping of digits to letters (just like on the telephone buttons) is given below. Note that 1 does not map to any letters.</p>
10+
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0000-0099/0017.Letter%20Combinations%20of%20a%20Phone%20Number/images/1200px-telephone-keypad2svg.png" style="width: 300px; height: 243px;" />
1311
<p>&nbsp;</p>
1412
<p><strong>Example 1:</strong></p>
1513

solution/0000-0099/0033.Search in Rotated Sorted Array/README.md

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,13 @@
88

99
<p>整数数组 <code>nums</code> 按升序排列,数组中的值 <strong>互不相同</strong> 。</p>
1010

11-
<p>在传递给函数之前,<code>nums</code> 在预先未知的某个下标 <code>k</code>(<code>0 <= k < nums.length</code>)上进行了 <strong>旋转</strong>,使数组变为 <code>[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]</code>(下标 <strong>从 0 开始</strong> 计数)。例如, <code>[0,1,2,4,5,6,7]</code> 在下标 <code>3</code> 处经旋转后可能变为 <code>[4,5,6,7,0,1,2]</code> 。</p>
11+
<p>在传递给函数之前,<code>nums</code> 在预先未知的某个下标 <code>k</code>(<code>0 &lt;= k &lt; nums.length</code>)上进行了 <strong>旋转</strong>,使数组变为 <code>[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]</code>(下标 <strong>从 0 开始</strong> 计数)。例如, <code>[0,1,2,4,5,6,7]</code> 在下标 <code>3</code> 处经旋转后可能变为&nbsp;<code>[4,5,6,7,0,1,2]</code> 。</p>
1212

13-
<p>给你 <strong>旋转后</strong> 的数组 <code>nums</code> 和一个整数 <code>target</code> ,如果 <code>nums</code> 中存在这个目标值 <code>target</code> ,则返回它的下标,否则返回 <code>-1</code> 。</p>
13+
<p>给你 <strong>旋转后</strong> 的数组 <code>nums</code> 和一个整数 <code>target</code> ,如果 <code>nums</code> 中存在这个目标值 <code>target</code> ,则返回它的下标,否则返回&nbsp;<code>-1</code>&nbsp;。</p>
1414

15-
<p> </p>
15+
<p>你必须设计一个时间复杂度为 <code>O(log n)</code> 的算法解决此问题。</p>
16+
17+
<p>&nbsp;</p>
1618

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

@@ -21,7 +23,7 @@
2123
<strong>输出:</strong>4
2224
</pre>
2325

24-
<p><strong>示例 2:</strong></p>
26+
<p><strong>示例&nbsp;2:</strong></p>
2527

2628
<pre>
2729
<strong>输入:</strong>nums = [<code>4,5,6,7,0,1,2]</code>, target = 3
@@ -34,22 +36,18 @@
3436
<strong>输出:</strong>-1
3537
</pre>
3638

37-
<p> </p>
39+
<p>&nbsp;</p>
3840

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

4143
<ul>
42-
<li><code>1 <= nums.length <= 5000</code></li>
43-
<li><code>-10^4 <= nums[i] <= 10^4</code></li>
44+
<li><code>1 &lt;= nums.length &lt;= 5000</code></li>
45+
<li><code>-10<sup>4</sup> &lt;= nums[i] &lt;= 10<sup>4</sup></code></li>
4446
<li><code>nums</code> 中的每个值都 <strong>独一无二</strong></li>
4547
<li>题目数据保证 <code>nums</code> 在预先未知的某个下标上进行了旋转</li>
46-
<li><code>-10^4 <= target <= 10^4</code></li>
48+
<li><code>-10<sup>4</sup> &lt;= target &lt;= 10<sup>4</sup></code></li>
4749
</ul>
4850

49-
<p> </p>
50-
51-
<p><strong>进阶:</strong>你可以设计一个时间复杂度为 <code>O(log n)</code> 的解决方案吗?</p>
52-
5351
## 解法
5452

5553
<!-- 这里可写通用的实现逻辑 -->

solution/0000-0099/0034.Find First and Last Position of Element in Sorted Array/README.md

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,25 +6,21 @@
66

77
<!-- 这里写题目描述 -->
88

9-
<p>给定一个按照升序排列的整数数组 <code>nums</code>,和一个目标值 <code>target</code>。找出给定目标值在数组中的开始位置和结束位置。</p>
9+
<p>给你一个按照非递减顺序排列的整数数组 <code>nums</code>,和一个目标值 <code>target</code>。请你找出给定目标值在数组中的开始位置和结束位置。</p>
1010

11-
<p>如果数组中不存在目标值 <code>target</code>,返回 <code>[-1, -1]</code>。</p>
11+
<p>如果数组中不存在目标值 <code>target</code>,返回&nbsp;<code>[-1, -1]</code>。</p>
1212

13-
<p><strong>进阶:</strong></p>
13+
<p>你必须设计并实现时间复杂度为&nbsp;<code>O(log n)</code>&nbsp;的算法解决此问题。</p>
1414

15-
<ul>
16-
<li>你可以设计并实现时间复杂度为 <code>O(log n)</code> 的算法解决此问题吗?</li>
17-
</ul>
18-
19-
<p> </p>
15+
<p>&nbsp;</p>
2016

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

2319
<pre>
2420
<strong>输入:</strong>nums = [<code>5,7,7,8,8,10]</code>, target = 8
2521
<strong>输出:</strong>[3,4]</pre>
2622

27-
<p><strong>示例 2:</strong></p>
23+
<p><strong>示例&nbsp;2:</strong></p>
2824

2925
<pre>
3026
<strong>输入:</strong>nums = [<code>5,7,7,8,8,10]</code>, target = 6
@@ -36,15 +32,15 @@
3632
<strong>输入:</strong>nums = [], target = 0
3733
<strong>输出:</strong>[-1,-1]</pre>
3834

39-
<p> </p>
35+
<p>&nbsp;</p>
4036

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

4339
<ul>
44-
<li><code>0 <= nums.length <= 10<sup>5</sup></code></li>
45-
<li><code>-10<sup>9</sup> <= nums[i] <= 10<sup>9</sup></code></li>
46-
<li><code>nums</code> 是一个非递减数组</li>
47-
<li><code>-10<sup>9</sup> <= target <= 10<sup>9</sup></code></li>
40+
<li><code>0 &lt;= nums.length &lt;= 10<sup>5</sup></code></li>
41+
<li><code>-10<sup>9</sup>&nbsp;&lt;= nums[i]&nbsp;&lt;= 10<sup>9</sup></code></li>
42+
<li><code>nums</code>&nbsp;是一个非递减数组</li>
43+
<li><code>-10<sup>9</sup>&nbsp;&lt;= target&nbsp;&lt;= 10<sup>9</sup></code></li>
4844
</ul>
4945

5046
## 解法

solution/0000-0099/0050.Pow(x, n)/README.md

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

77
<!-- 这里写题目描述 -->
88

9-
<p>实现&nbsp;<a href="https://www.cplusplus.com/reference/valarray/pow/" target="_blank">pow(<em>x</em>, <em>n</em>)</a>&nbsp;,即计算 <code>x</code> <code>n</code> 次幂函数(即,<code>x<sup>n</sup></code><sup><span style="font-size:10.8333px"> </span></sup>)。</p>
9+
<p>实现&nbsp;<a href="https://www.cplusplus.com/reference/valarray/pow/" target="_blank">pow(<em>x</em>, <em>n</em>)</a>&nbsp;,即计算 <code>x</code> 的整数&nbsp;<code>n</code> 次幂函数(即,<code>x<sup>n</sup></code><sup><span style="font-size:10.8333px"> </span></sup>)。</p>
1010

1111
<p>&nbsp;</p>
1212

solution/0000-0099/0056.Merge Intervals/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
<pre>
1313
<strong>Input:</strong> intervals = [[1,3],[2,6],[8,10],[15,18]]
1414
<strong>Output:</strong> [[1,6],[8,10],[15,18]]
15-
<strong>Explanation:</strong> Since intervals [1,3] and [2,6] overlaps, merge them into [1,6].
15+
<strong>Explanation:</strong> Since intervals [1,3] and [2,6] overlap, merge them into [1,6].
1616
</pre>
1717

1818
<p><strong>Example 2:</strong></p>

solution/0000-0099/0068.Text Justification/README_EN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,13 @@
1010

1111
<p>Extra spaces between words should be distributed as evenly as possible. If the number of spaces on a line does not divide evenly between words, the empty slots on the left will be assigned more spaces than the slots on the right.</p>
1212

13-
<p>For the last line of text, it should be left-justified and no extra space is inserted between words.</p>
13+
<p>For the last line of text, it should be left-justified, and no extra space is inserted between words.</p>
1414

1515
<p><strong>Note:</strong></p>
1616

1717
<ul>
1818
<li>A word is defined as a character sequence consisting of non-space characters only.</li>
19-
<li>Each word&#39;s length is guaranteed to be greater than 0 and not exceed maxWidth.</li>
19+
<li>Each word&#39;s length is guaranteed to be greater than <code>0</code> and not exceed <code>maxWidth</code>.</li>
2020
<li>The input array <code>words</code> contains at least one word.</li>
2121
</ul>
2222

@@ -43,7 +43,7 @@
4343
&nbsp; &quot;shall be &nbsp; &nbsp; &nbsp; &nbsp;&quot;
4444
]
4545
<strong>Explanation:</strong> Note that the last line is &quot;shall be &quot; instead of &quot;shall be&quot;, because the last line must be left-justified instead of fully-justified.
46-
Note that the second line is also left-justified becase it contains only one word.</pre>
46+
Note that the second line is also left-justified because it contains only one word.</pre>
4747

4848
<p><strong>Example 3:</strong></p>
4949

solution/0100-0199/0126.Word Ladder II/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<ul>
4646
<li><code>1 &lt;= beginWord.length &lt;= 5</code></li>
4747
<li><code>endWord.length == beginWord.length</code></li>
48-
<li><code>1 &lt;= wordList.length &lt;= 5000</code></li>
48+
<li><code>1 &lt;= wordList.length &lt;= 500</code></li>
4949
<li><code>wordList[i].length == beginWord.length</code></li>
5050
<li><code>beginWord</code>、<code>endWord</code> 和 <code>wordList[i]</code> 由小写英文字母组成</li>
5151
<li><code>beginWord != endWord</code></li>

solution/0100-0199/0126.Word Ladder II/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
<ul>
4040
<li><code>1 &lt;= beginWord.length &lt;= 5</code></li>
4141
<li><code>endWord.length == beginWord.length</code></li>
42-
<li><code>1 &lt;= wordList.length &lt;= 1000</code></li>
42+
<li><code>1 &lt;= wordList.length &lt;= 500</code></li>
4343
<li><code>wordList[i].length == beginWord.length</code></li>
4444
<li><code>beginWord</code>, <code>endWord</code>, and <code>wordList[i]</code> consist of lowercase English letters.</li>
4545
<li><code>beginWord != endWord</code></li>

0 commit comments

Comments
 (0)