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 d0e8c21

Browse files
committed
feat: add new lc problems
1 parent 3f2f432 commit d0e8c21

File tree

41 files changed

+1466
-321
lines changed

Some content is hidden

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

41 files changed

+1466
-321
lines changed

‎solution/0400-0499/0424.Longest Repeating Character Replacement/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
<strong>Output:</strong> 4
2525
<strong>Explanation:</strong> Replace the one &#39;A&#39; in the middle with &#39;B&#39; and form &quot;AABBBBA&quot;.
2626
The substring &quot;BBBB&quot; has the longest repeating letters, which is 4.
27-
</pre>
27+
There may exists other ways to achive this answer too.</pre>
2828

2929
<p>&nbsp;</p>
3030
<p><strong>Constraints:</strong></p>

‎solution/0400-0499/0436.Find Right Interval/README.md‎

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

99
<p>给你一个区间数组 <code>intervals</code> ,其中&nbsp;<code>intervals[i] = [start<sub>i</sub>, end<sub>i</sub>]</code> ,且每个&nbsp;<code>start<sub>i</sub></code> 都 <strong>不同</strong> 。</p>
1010

11-
<p>区间 <code>i</code> 的 <strong>右侧区间</strong> 可以记作区间 <code>j</code> ,并满足 <code>start<sub>j</sub></code><code>&nbsp;&gt;= end<sub>i</sub></code> ,且 <code>start<sub>j</sub></code> <strong>最小化 </strong>。</p>
11+
<p>区间 <code>i</code> 的 <strong>右侧区间</strong> 可以记作区间 <code>j</code> ,并满足 <code>start<sub>j</sub></code><code>&nbsp;&gt;= end<sub>i</sub></code> ,且 <code>start<sub>j</sub></code> <strong>最小化 </strong>。注意 <code>i</code> 可能等于 <code>j</code> 。</p>
1212

1313
<p>返回一个由每个区间 <code>i</code> 的 <strong>右侧区间</strong> 在&nbsp;<code>intervals</code> 中对应下标组成的数组。如果某个区间 <code>i</code> 不存在对应的 <strong>右侧区间</strong> ,则下标 <code>i</code> 处的值设为 <code>-1</code> 。</p>
1414
&nbsp;

‎solution/0800-0899/0852.Peak Index in a Mountain Array/README.md‎

Lines changed: 11 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,20 @@
99
符合下列属性的数组 <code>arr</code> 称为 <strong>山脉数组</strong> :
1010

1111
<ul>
12-
<li><code>arr.length >= 3</code></li>
13-
<li>存在 <code>i</code>(<code>0 < i < arr.length - 1</code>)使得:
12+
<li><code>arr.length &gt;= 3</code></li>
13+
<li>存在 <code>i</code>(<code>0 &lt; i&nbsp;&lt; arr.length - 1</code>)使得:
1414
<ul>
15-
<li><code>arr[0] < arr[1] < ... arr[i-1] < arr[i] </code></li>
16-
<li><code>arr[i] > arr[i+1] > ... > arr[arr.length - 1]</code></li>
15+
<li><code>arr[0] &lt; arr[1] &lt; ... arr[i-1] &lt; arr[i] </code></li>
16+
<li><code>arr[i] &gt; arr[i+1] &gt; ... &gt; arr[arr.length - 1]</code></li>
1717
</ul>
1818
</li>
1919
</ul>
2020

21-
<p>给你由整数组成的山脉数组 <code>arr</code> ,返回任何满足 <code>arr[0] < arr[1] < ... arr[i - 1] < arr[i] > arr[i + 1] > ... > arr[arr.length - 1]</code> 的下标 <code>i</code> 。</p>
21+
<p>给你由整数组成的山脉数组 <code>arr</code> ,返回满足 <code>arr[0] &lt; arr[1] &lt; ... arr[i - 1] &lt; arr[i] &gt; arr[i + 1] &gt; ... &gt; arr[arr.length - 1]</code> 的下标 <code>i</code> 。</p>
2222

23-
<p> </p>
23+
<p>你必须设计并实现时间复杂度为 <code>O(log(n))</code> 的解决方案。</p>
24+
25+
<p>&nbsp;</p>
2426

2527
<p><strong>示例 1:</strong></p>
2628

@@ -43,34 +45,16 @@
4345
<strong>输出:</strong>1
4446
</pre>
4547

46-
<p><strong>示例 4:</strong></p>
47-
48-
<pre>
49-
<strong>输入:</strong>arr = [3,4,5,1]
50-
<strong>输出:</strong>2
51-
</pre>
52-
53-
<p><strong>示例 5:</strong></p>
54-
55-
<pre>
56-
<strong>输入:</strong>arr = [24,69,100,99,79,78,67,36,26,19]
57-
<strong>输出:</strong>2
58-
</pre>
59-
60-
<p> </p>
48+
<p>&nbsp;</p>
6149

6250
<p><strong>提示:</strong></p>
6351

6452
<ul>
65-
<li><code>3 <= arr.length <= 10<sup>4</sup></code></li>
66-
<li><code>0 <= arr[i] <= 10<sup>6</sup></code></li>
53+
<li><code>3 &lt;= arr.length &lt;= 10<sup>5</sup></code></li>
54+
<li><code>0 &lt;= arr[i] &lt;= 10<sup>6</sup></code></li>
6755
<li>题目数据保证 <code>arr</code> 是一个山脉数组</li>
6856
</ul>
6957

70-
<p> </p>
71-
72-
<p><strong>进阶:</strong>很容易想到时间复杂度 <code>O(n)</code> 的解决方案,你可以设计一个 <code>O(log(n))</code> 的解决方案吗?</p>
73-
7458
## 解法
7559

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

‎solution/0800-0899/0877.Stone Game/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class Solution:
5757
if i > j:
5858
return 0
5959
return max(piles[i] - dfs(i + 1, j), piles[j] - dfs(i, j - 1))
60-
60+
6161
return dfs(0, len(piles) - 1) > 0
6262
```
6363

‎solution/1000-1099/1071.Greatest Common Divisor of Strings/README.md‎

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

99
<p>对于字符串&nbsp;<code>s</code> 和&nbsp;<code>t</code>,只有在&nbsp;<code>s = t + ... + t</code>(<code>t</code> 自身连接 1 次或多次)时,我们才认定&nbsp;"<code>t</code> 能除尽 <code>s</code>"。</p>
1010

11-
<p>给定两个字符串&nbsp;<code>str1</code>&nbsp;&nbsp;<code>str2</code>&nbsp;。返回 <em>最长字符串&nbsp;<code>x</code>,要求满足&nbsp;<code>x</code> 能除尽 <code>str1</code> 且&nbsp;<code>X</code> 能除尽 <code>str2</code></em> 。</p>
11+
<p>给定两个字符串&nbsp;<code>str1</code>&nbsp;&nbsp;<code>str2</code>&nbsp;。返回 <em>最长字符串&nbsp;<code>x</code>,要求满足&nbsp;<code>x</code> 能除尽 <code>str1</code> 且<code>x</code> 能除尽 <code>str2</code></em> 。</p>
1212

1313
<p>&nbsp;</p>
1414

‎solution/1300-1399/1339.Maximum Product of Splitted Binary Tree/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public:
160160
}
161161
return t;
162162
};
163-
163+
164164
dfs(root);
165165
return ans % mod;
166166
}

‎solution/1300-1399/1384.Total Sales Amount by Year/README.md‎

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,20 @@ product_name 是产品的名称。
3535
product_id 是这张表的主键。
3636
period_start&nbsp;和 period_end&nbsp;是该产品销售期的起始日期和结束日期,且这两个日期包含在销售期内。
3737
average_daily_sales 列存储销售期内该产品的日平均销售额。
38+
销售日期范围为2018年到2020年。
3839
</pre>
3940

4041
<p>&nbsp;</p>
4142

42-
<p>编写一段 SQL 查询每个产品每年的总销售额,并包含 product_id, product_name 以及 report_year 等信息。</p>
43+
<p>编写一段 SQL 查询,查找出每个产品每年的总销售额,并包含 <code>product_id</code> , <code>product_name</code> ,&nbsp;<code>report_year</code> 以及 <code>total_amount</code>&nbsp;。</p>
4344

44-
<p>销售年份的日期介于 2018 年到 2020 年之间。你返回的结果需要按&nbsp;product_id 和 report_year<strong> 排序</strong>。</p>
45+
<p>返回结果并按&nbsp;<code>product_id</code><code>report_year</code><strong> 排序</strong>。</p>
4546

4647
<p>查询结果格式如下例所示。</p>
4748

4849
<p>&nbsp;</p>
4950

50-
<p><strong>示例 1:</strong></p>
51+
<p><strongclass="example">示例 1:</strong></p>
5152

5253
<pre>
5354
<code><strong>输入:</strong>

‎solution/1300-1399/1384.Total Sales Amount by Year/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ The dates of the sales years are between 2018 to 2020.
3838

3939
<p>&nbsp;</p>
4040

41-
<p>Write an SQL query to report the total sales amount of each item for each year, with corresponding <code>product_name</code>, <code>product_id</code>, <code>product_name</code>, and <code>report_year</code>.</p>
41+
<p>Write an SQL query to report the total sales amount of each item for each year, with corresponding <code>product_name</code>, <code>product_id</code>, <code>report_year</code>, and <code>total_amount</code>.</p>
4242

4343
<p>Return the result table <strong>ordered</strong> by <code>product_id</code> and <code>report_year</code>.</p>
4444

‎solution/1600-1699/1601.Maximum Number of Achievable Transfer Requests/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ class Solution {
9292
public int maximumRequests(int n, int[][] requests) {
9393
m = requests.length;
9494
this.n = n;
95-
this.requests = requests;
95+
this.requests = requests;
9696
int ans = 0;
9797
for (int mask = 0; mask < 1 << m; ++mask) {
9898
int cnt = Integer.bitCount(mask);

‎solution/1700-1799/1751.Maximum Number of Events That Can Be Attended II/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ class Solution:
115115
j = bisect_right(events, ed, lo=i + 1, key=lambda x: x[0])
116116
ans = max(ans, dfs(j, k - 1) + val)
117117
return ans
118-
118+
119119
events.sort()
120120
return dfs(0, k)
121121
```

0 commit comments

Comments
(0)

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