Skip to content

Commit 18dbf9d

Browse files
authored
feat: add new lc problems and solutions (doocs#1120)
1 parent 5f99195 commit 18dbf9d

File tree

56 files changed

+3222
-274
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

+3222
-274
lines changed

.github/workflows/clang-format-lint.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ jobs:
1919
inplace: True
2020

2121
- uses: EndBug/add-and-commit@v9
22-
with:
23-
committer_name: yanglbme
24-
committer_email: contact@yanglibin.info
25-
message: 'chore: format code with clang-format'
26-
env:
27-
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}
22+
with:
23+
committer_name: yanglbme
24+
committer_email: contact@yanglibin.info
25+
message: 'chore: format code with clang-format'
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.ACTION_TOKEN }}

solution/0000-0099/0074.Search a 2D Matrix/README.md

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,16 @@
66

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

9-
<p>编写一个高效的算法来判断 <code>m x n</code> 矩阵中,是否存在一个目标值。该矩阵具有如下特性:</p>
9+
<p>给你一个满足下述两条属性的 <code>m x n</code> 整数矩阵:</p>
1010

1111
<ul>
12-
<li>每行中的整数从左到右按升序排列。</li>
12+
<li>每行中的整数从左到右按非递减顺序排列。</li>
1313
<li>每行的第一个整数大于前一行的最后一个整数。</li>
1414
</ul>
1515

16-
<p> </p>
16+
<p>给你一个整数 <code>target</code> ,如果 <code>target</code> 在矩阵中,返回 <code>true</code> ;否则,返回 <code>false</code> 。</p>
17+
18+
<p>&nbsp;</p>
1719

1820
<p><strong>示例 1:</strong></p>
1921
<img alt="" src="https://fastly.jsdelivr.net/gh/doocs/leetcode@main/solution/0000-0099/0074.Search%20a%202D%20Matrix/images/mat.jpg" style="width: 322px; height: 242px;" />
@@ -29,15 +31,15 @@
2931
<strong>输出:</strong>false
3032
</pre>
3133

32-
<p> </p>
34+
<p>&nbsp;</p>
3335

3436
<p><strong>提示:</strong></p>
3537

3638
<ul>
3739
<li><code>m == matrix.length</code></li>
3840
<li><code>n == matrix[i].length</code></li>
39-
<li><code>1 <= m, n <= 100</code></li>
40-
<li><code>-10<sup>4</sup> <= matrix[i][j], target <= 10<sup>4</sup></code></li>
41+
<li><code>1 &lt;= m, n &lt;= 100</code></li>
42+
<li><code>-10<sup>4</sup> &lt;= matrix[i][j], target &lt;= 10<sup>4</sup></code></li>
4143
</ul>
4244

4345
## 解法

solution/0300-0399/0373.Find K Pairs with Smallest Sums/README_EN.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
## Description
66

7-
<p>You are given two integer arrays <code>nums1</code> and <code>nums2</code> sorted in <strong>ascending order</strong> and an integer <code>k</code>.</p>
7+
<p>You are given two integer arrays <code>nums1</code> and <code>nums2</code> sorted in <strong>non-decreasing&nbsp;order</strong> and an integer <code>k</code>.</p>
88

99
<p>Define a pair <code>(u, v)</code> which consists of one element from the first array and one element from the second array.</p>
1010

@@ -41,7 +41,7 @@
4141
<ul>
4242
<li><code>1 &lt;= nums1.length, nums2.length &lt;= 10<sup>5</sup></code></li>
4343
<li><code>-10<sup>9</sup> &lt;= nums1[i], nums2[i] &lt;= 10<sup>9</sup></code></li>
44-
<li><code>nums1</code> and <code>nums2</code> both are sorted in <strong>ascending order</strong>.</li>
44+
<li><code>nums1</code> and <code>nums2</code> both are sorted in <strong>non-decreasing order</strong>.</li>
4545
<li><code>1 &lt;= k &lt;= 10<sup>4</sup></code></li>
4646
</ul>
4747

solution/1500-1599/1511.Customer Order Frequency/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,6 @@ Winston 在2020年6月花费了300(300 * 1), 在7月花费了100(10 * 1 + 45 * 2
113113
Jonathan 在2020年6月花费了600(300 * 2), 在7月花费了20(2 * 10).
114114
Moustafa 在2020年6月花费了110 (10 * 2 + 45 * 2), 在7月花费了0.</pre>
115115

116-
117116
## 解法
118117

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

solution/1500-1599/1511.Customer Order Frequency/README_EN.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ Jonathan spent 600 (300 * 2) in June and 20 ( 2 * 10) in July 2020.
110110
Moustafa spent 110 (10 * 2 + 45 * 2) in June and 0 in July 2020.
111111
</pre>
112112

113-
114113
## Solutions
115114

116115
<!-- tabs:start -->

solution/2400-2499/2448.Minimum Cost to Make Array Equal/README_EN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ It can be shown that we cannot make the array equal with a smaller cost.
4545
<li><code>n == nums.length == cost.length</code></li>
4646
<li><code>1 &lt;= n &lt;= 10<sup>5</sup></code></li>
4747
<li><code>1 &lt;= nums[i], cost[i] &lt;= 10<sup>6</sup></code></li>
48+
<li>Test cases are generated in a way that the output doesn&#39;t exceed&nbsp;2<sup>53</sup>-1</li>
4849
</ul>
4950

5051
## Solutions

solution/2400-2499/2490.Circular Sentence/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545
<strong>输入:</strong>sentence = "eetcode"
4646
<strong>输出:</strong>true
4747
<strong>解释:</strong>句子中的单词是 ["eetcode"] 。
48-
- eetcod<em><strong>e</strong></em> 的最后一个字符和 eetcod<em><strong>e</strong></em> 的第一个字符相等。
48+
- eetcod<em><strong>e</strong></em> 的最后一个字符和 <em><strong>e</strong></em>etcod<em>e</em> 的第一个字符相等。
4949
这个句子是回环句。</pre>
5050

5151
<p><strong>示例 3:</strong></p>
@@ -54,7 +54,7 @@
5454
<strong>输入:</strong>sentence = "Leetcode is cool"
5555
<strong>输出:</strong>false
5656
<strong>解释:</strong>句子中的单词是 ["Leetcode", "is", "cool"] 。
57-
- Leetcod<em><strong>e</strong></em>&nbsp;的最后一个字符和 i<strong><em>s</em></strong> 的第一个字符 <strong>不</strong> 相等。
57+
- Leetcod<em><strong>e</strong></em>&nbsp;的最后一个字符和 <em><strong>i</strong></em>s 的第一个字符 <strong>不</strong> 相等。
5858
这个句子 <strong>不</strong> 是回环句。</pre>
5959

6060
<p>&nbsp;</p>

solution/2600-2699/2627.Debounce/README_EN.md

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

77
<p>Given a function&nbsp;<code>fn</code> and a time in milliseconds&nbsp;<code>t</code>, return&nbsp;a&nbsp;<strong>debounced</strong>&nbsp;version of that function.</p>
88

9-
<p>A&nbsp;<strong>debounced</strong>&nbsp;function is a function whose execution is delayed by&nbsp;<code>t</code>&nbsp;milliseconds and whose&nbsp;execution is cancelled if it is called again within that window of time. The debounced function should also recieve the passed parameters.</p>
9+
<p>A&nbsp;<strong>debounced</strong>&nbsp;function is a function whose execution is delayed by&nbsp;<code>t</code>&nbsp;milliseconds and whose&nbsp;execution is cancelled if it is called again within that window of time. The debounced function should also receive the passed parameters.</p>
1010

1111
<p>For example, let&#39;s say&nbsp;<code>t = 50ms</code>, and the function was called at&nbsp;<code>30ms</code>,&nbsp;<code>60ms</code>, and <code>100ms</code>. The first 2 function calls would be cancelled, and the 3rd function call would be executed at&nbsp;<code>150ms</code>. If instead&nbsp;<code>t = 35ms</code>, The 1st call would be cancelled, the 2nd would be executed at&nbsp;<code>95ms</code>, and the 3rd would be executed at&nbsp;<code>135ms</code>.</p>
1212

solution/2600-2699/2693.Call Function with Custom Context/README_EN.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ callPolyfill sets the &quot;this&quot; context to {&quot;a&quot;: 5}. 7 is passe
4343
fn = function tax(price, taxRate) {
4444
&nbsp;return `The cost of the ${this.item} is ${price * taxRate}`;
4545
}
46-
args = [{&quot;item&quot;: &quot;burger&quot;}, 10, 1,1]
46+
args = [{&quot;item&quot;: &quot;burger&quot;}, 10, 1.1]
4747
<strong>Output:</strong> &quot;The cost of the burger is 11&quot;
4848
<strong>Explanation:</strong> callPolyfill sets the &quot;this&quot; context to {&quot;item&quot;: &quot;burger&quot;}. 10 and 1.1 are passed as additional arguments.
4949
</pre>

solution/2600-2699/2695.Array Wrapper/README_EN.md

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

55
## Description
66

7-
<p>Create a class&nbsp;<code>ArrayWrapper</code> that accepts&nbsp;an array of integers in it&#39;s constructor. This class should have two features:</p>
7+
<p>Create a class&nbsp;<code>ArrayWrapper</code> that accepts&nbsp;an array of integers in its constructor. This class should have two features:</p>
88

99
<ul>
1010
<li>When two instances of this class are added together with the&nbsp;<code>+</code>&nbsp;operator, the resulting value is the sum of all the elements in&nbsp;both arrays.</li>

0 commit comments

Comments
 (0)