Skip to content

Commit ac74122

Browse files
authored
feat: add new lc problems (#4634)
1 parent 8a1b741 commit ac74122

File tree

59 files changed

+1666
-120
lines changed

Some content is hidden

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

59 files changed

+1666
-120
lines changed

solution/0000-0099/0032.Longest Valid Parentheses/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ tags:
1818

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

21-
<p>给你一个只包含 <code>'('</code>&nbsp;和 <code>')'</code>&nbsp;的字符串,找出最长有效(格式正确且连续)括号<span data-keyword="substring">子串</span>的长度。</p>
21+
<p>给你一个只包含 <code>'('</code> 和 <code>')'</code> 的字符串,找出最长有效(格式正确且连续)括号 <span data-keyword="substring">子串</span> 的长度。</p>
22+
23+
<p>左右括号匹配,即每个左括号都有对应的右括号将其闭合的字符串是格式正确的,比如&nbsp;<code>"(()())"</code>。</p>
2224

2325
<p>&nbsp;</p>
2426

solution/0000-0099/0033.Search in Rotated Sorted 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>nums</code> 按升序排列,数组中的值 <strong>互不相同</strong> 。</p>
2121

22-
<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>
22+
<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> 向左旋转&nbsp;<code>3</code>&nbsp;次后可能变为&nbsp;<code>[4,5,6,7,0,1,2]</code> 。</p>
2323

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

solution/0000-0099/0033.Search in Rotated Sorted 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>There is an integer array <code>nums</code> sorted in ascending order (with <strong>distinct</strong> values).</p>
2121

22-
<p>Prior to being passed to your function, <code>nums</code> is <strong>possibly rotated</strong> at an unknown pivot index <code>k</code> (<code>1 &lt;= k &lt; nums.length</code>) such that the resulting array is <code>[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]</code> (<strong>0-indexed</strong>). For example, <code>[0,1,2,4,5,6,7]</code> might be rotated at pivot index <code>3</code> and become <code>[4,5,6,7,0,1,2]</code>.</p>
22+
<p>Prior to being passed to your function, <code>nums</code> is <strong>possibly left rotated</strong> at an unknown index <code>k</code> (<code>1 &lt;= k &lt; nums.length</code>) such that the resulting array is <code>[nums[k], nums[k+1], ..., nums[n-1], nums[0], nums[1], ..., nums[k-1]]</code> (<strong>0-indexed</strong>). For example, <code>[0,1,2,4,5,6,7]</code> might be left rotated by&nbsp;<code>3</code>&nbsp;indices and become <code>[4,5,6,7,0,1,2]</code>.</p>
2323

2424
<p>Given the array <code>nums</code> <strong>after</strong> the possible rotation and an integer <code>target</code>, return <em>the index of </em><code>target</code><em> if it is in </em><code>nums</code><em>, or </em><code>-1</code><em> if it is not in </em><code>nums</code>.</p>
2525

solution/0000-0099/0045.Jump Game II/README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ tags:
2020

2121
<p>给定一个长度为 <code>n</code> 的 <strong>0 索引</strong>整数数组 <code>nums</code>。初始位置为 <code>nums[0]</code>。</p>
2222

23-
<p>每个元素 <code>nums[i]</code> 表示从索引 <code>i</code> 向后跳转的最大长度。换句话说,如果你在 <code>nums[i]</code> 处,你可以跳转到任意 <code>nums[i + j]</code> 处:</p>
23+
<p>每个元素 <code>nums[i]</code> 表示从索引 <code>i</code> 向后跳转的最大长度。换句话说,如果你在索引&nbsp;<code>i</code>&nbsp;处,你可以跳转到任意 <code>(i + j)</code> 处</p>
2424

2525
<ul>
26-
<li><code>0 &lt;= j &lt;= nums[i]</code>&nbsp;</li>
26+
<li><code>0 &lt;= j &lt;= nums[i]</code>&nbsp;</li>
2727
<li><code>i + j &lt; n</code></li>
2828
</ul>
2929

30-
<p>返回到达&nbsp;<code>nums[n - 1]</code> 的最小跳跃次数。生成的测试用例可以到达 <code>nums[n - 1]</code>。</p>
30+
<p>返回到达&nbsp;<code>n - 1</code>&nbsp;的最小跳跃次数。测试用例保证可以到达 <code>n - 1</code>。</p>
3131

3232
<p>&nbsp;</p>
3333

@@ -54,7 +54,7 @@ tags:
5454
<ul>
5555
<li><code>1 &lt;= nums.length &lt;= 10<sup>4</sup></code></li>
5656
<li><code>0 &lt;= nums[i] &lt;= 1000</code></li>
57-
<li>题目保证可以到达&nbsp;<code>nums[n-1]</code></li>
57+
<li>题目保证可以到达&nbsp;<code>n - 1</code></li>
5858
</ul>
5959

6060
<!-- description:end -->

solution/0000-0099/0045.Jump Game II/README_EN.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ tags:
1818

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

21-
<p>You are given a <strong>0-indexed</strong> array of integers <code>nums</code> of length <code>n</code>. You are initially positioned at <code>nums[0]</code>.</p>
21+
<p>You are given a <strong>0-indexed</strong> array of integers <code>nums</code> of length <code>n</code>. You are initially positioned at&nbsp;index 0.</p>
2222

23-
<p>Each element <code>nums[i]</code> represents the maximum length of a forward jump from index <code>i</code>. In other words, if you are at <code>nums[i]</code>, you can jump to any <code>nums[i + j]</code> where:</p>
23+
<p>Each element <code>nums[i]</code> represents the maximum length of a forward jump from index <code>i</code>. In other words, if you are at index <code>i</code>, you can jump to any index <code>(i + j)</code>&nbsp;where:</p>
2424

2525
<ul>
2626
<li><code>0 &lt;= j &lt;= nums[i]</code> and</li>
2727
<li><code>i + j &lt; n</code></li>
2828
</ul>
2929

30-
<p>Return <em>the minimum number of jumps to reach </em><code>nums[n - 1]</code>. The test cases are generated such that you can reach <code>nums[n - 1]</code>.</p>
30+
<p>Return <em>the minimum number of jumps to reach index </em><code>n - 1</code>. The test cases are generated such that you can reach index&nbsp;<code>n - 1</code>.</p>
3131

3232
<p>&nbsp;</p>
3333
<p><strong class="example">Example 1:</strong></p>

solution/0100-0199/0190.Reverse Bits/README.md

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

2424
<ul>
2525
<li>请注意,在某些语言(如 Java)中,没有无符号整数类型。在这种情况下,输入和输出都将被指定为有符号整数类型,并且不应影响您的实现,因为无论整数是有符号的还是无符号的,其内部的二进制表示形式都是相同的。</li>
26-
<li>在 Java 中,编译器使用<a href="https://baike.baidu.com/item/二进制补码/5295284" target="_blank">二进制补码</a>记法来表示有符号整数。因此,在 <strong>示例 2</strong>&nbsp;中,输入表示有符号整数 <code>-3</code>,输出表示有符号整数 <code>-1073741825</code>。</li>
26+
<li>在 Java 中,编译器使用<a href="https://baike.baidu.com/item/二进制补码/5295284" target="_blank">二进制补码</a>记法来表示有符号整数。</li>
2727
</ul>
2828

2929
<p>&nbsp;</p>

solution/0100-0199/0190.Reverse Bits/README_EN.md

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

2424
<ul>
2525
<li>Note that in some languages, such as Java, there is no unsigned integer type. In this case, both input and output will be given as a signed integer type. They should not affect your implementation, as the integer&#39;s internal binary representation is the same, whether it is signed or unsigned.</li>
26-
<li>In Java, the compiler represents the signed integers using <a href="https://en.wikipedia.org/wiki/Two%27s_complement" target="_blank">2&#39;s complement notation</a>. Therefore, in <strong class="example">Example 2</strong>&nbsp;below, the input represents the signed integer <code>-3</code> and the output represents the signed integer <code>-1073741825</code>.</li>
26+
<li>In Java, the compiler represents the signed integers using <a href="https://en.wikipedia.org/wiki/Two%27s_complement" target="_blank">2&#39;s complement notation</a>.</li>
2727
</ul>
2828

2929
<p>&nbsp;</p>

solution/0300-0399/0307.Range Sum Query - Mutable/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ tags:
77
- 树状数组
88
- 线段树
99
- 数组
10+
- 分治
1011
---
1112

1213
<!-- problem:start -->

solution/0300-0399/0307.Range Sum Query - Mutable/README_EN.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ tags:
77
- Binary Indexed Tree
88
- Segment Tree
99
- Array
10+
- Divide and Conquer
1011
---
1112

1213
<!-- problem:start -->

solution/0300-0399/0308.Range Sum Query 2D - Mutable/README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,13 +62,13 @@ numMatrix.sumRegion(2, 1, 4, 3); // 返回 10 (即,右侧红色矩形的和)
6262
<li><code>m == matrix.length</code></li>
6363
<li><code>n == matrix[i].length</code></li>
6464
<li><code>1 &lt;= m, n &lt;= 200</code></li>
65-
<li><code>-10<sup>5</sup> &lt;= matrix[i][j] &lt;= 10<sup>5</sup></code></li>
65+
<li><code>-10<font size="1">00</font>&nbsp;&lt;= matrix[i][j] &lt;= 10<font size="1">00</font></code></li>
6666
<li><code>0 &lt;= row &lt; m</code></li>
6767
<li><code>0 &lt;= col &lt; n</code></li>
68-
<li><code>-10<sup>5</sup> &lt;= val &lt;= 10<sup>5</sup></code></li>
68+
<li><code>-10<font size="1">00</font>&nbsp;&lt;= val &lt;= 10<font size="1">00</font></code></li>
6969
<li><code>0 &lt;= row1 &lt;= row2 &lt; m</code></li>
7070
<li><code>0 &lt;= col1 &lt;= col2 &lt; n</code></li>
71-
<li>最多调用<code>10<sup>4</sup></code> 次&nbsp;<code>sumRegion</code> 和 <code>update</code> 方法</li>
71+
<li>最多调用<code>5000</code>&nbsp;次&nbsp;<code>sumRegion</code> 和 <code>update</code> 方法</li>
7272
</ul>
7373

7474
<!-- description:end -->

0 commit comments

Comments
 (0)