Skip to content

Commit 6f2245a

Browse files
committed
update
1 parent 8598592 commit 6f2245a

25 files changed

+13816
-11602
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# 力扣题库(完整版)
22

3-
> 最后更新日期: **2022.08.26**
3+
> 最后更新日期: **2022.08.29**
44
>
55
> 使用脚本前请务必仔细完整阅读本 `README.md` 文件
66

leetcode-cn/origin-data.json

Lines changed: 6930 additions & 6825 deletions
Large diffs are not rendered by default.
Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
{
2+
"data": {
3+
"question": {
4+
"questionId": "2523",
5+
"questionFrontendId": "2388",
6+
"categoryTitle": "Database",
7+
"boundTopicId": 1776356,
8+
"title": "Change Null Values in a Table to the Previous Value",
9+
"titleSlug": "change-null-values-in-a-table-to-the-previous-value",
10+
"content": null,
11+
"translatedTitle": null,
12+
"translatedContent": null,
13+
"isPaidOnly": true,
14+
"difficulty": "Medium",
15+
"likes": 0,
16+
"dislikes": 0,
17+
"isLiked": null,
18+
"similarQuestions": "[]",
19+
"contributors": [],
20+
"langToValidPlayground": null,
21+
"topicTags": [],
22+
"companyTagStats": null,
23+
"codeSnippets": null,
24+
"stats": "{\"totalAccepted\": \"24\", \"totalSubmission\": \"43\", \"totalAcceptedRaw\": 24, \"totalSubmissionRaw\": 43, \"acRate\": \"55.8%\"}",
25+
"hints": [],
26+
"solution": null,
27+
"status": null,
28+
"sampleTestCase": "{\"headers\": {\"CoffeeShop\": [\"id\", \"drink\"]}, \"rows\": {\"CoffeeShop\": [[9, \"Mezcal Margarita\"], [6, null], [7, null], [3, \"Americano\"], [1, \"Daiquiri\"], [2, null]]}}",
29+
"metaData": "{\n \"mysql\": [\n \"Create table If Not Exists CoffeeShop (id int, drink varchar(20))\"\n ],\n \"mssql\": [\n \"Create table CoffeeShop (id int, drink varchar(20))\"\n ],\n \"oraclesql\": [\n \"Create table CoffeeShop (id int, drink varchar(20))\"\n ],\n \"database\": true\n}",
30+
"judgerAvailable": true,
31+
"judgeType": "large",
32+
"mysqlSchemas": [
33+
"Create table If Not Exists CoffeeShop (id int, drink varchar(20))",
34+
"Truncate table CoffeeShop",
35+
"insert into CoffeeShop (id, drink) values ('9', 'Mezcal Margarita')",
36+
"insert into CoffeeShop (id, drink) values ('6', 'None')",
37+
"insert into CoffeeShop (id, drink) values ('7', 'None')",
38+
"insert into CoffeeShop (id, drink) values ('3', 'Americano')",
39+
"insert into CoffeeShop (id, drink) values ('1', 'Daiquiri')",
40+
"insert into CoffeeShop (id, drink) values ('2', 'None')"
41+
],
42+
"enableRunCode": true,
43+
"envInfo": "{\"mysql\":[\"MySQL\",\"<p>\\u7248\\u672c\\uff1a<code>MySQL 8.0<\\/code><\\/p>\"],\"mssql\":[\"MS SQL Server\",\"<p>mssql server 2019.<\\/p>\"],\"oraclesql\":[\"Oracle\",\"<p>Oracle Sql 11.2.<\\/p>\"]}",
44+
"book": null,
45+
"isSubscribed": false,
46+
"isDailyQuestion": false,
47+
"dailyRecordStatus": null,
48+
"editorType": "CKEDITOR",
49+
"ugcQuestionId": null,
50+
"style": "LEETCODE",
51+
"exampleTestcases": "{\"headers\": {\"CoffeeShop\": [\"id\", \"drink\"]}, \"rows\": {\"CoffeeShop\": [[9, \"Mezcal Margarita\"], [6, null], [7, null], [3, \"Americano\"], [1, \"Daiquiri\"], [2, null]]}}",
52+
"__typename": "QuestionNode"
53+
}
54+
}
55+
}

leetcode-cn/originData/build-a-matrix-with-conditions.json

Lines changed: 164 additions & 0 deletions
Large diffs are not rendered by default.

leetcode-cn/originData/longest-subsequence-with-limited-sum.json

Lines changed: 165 additions & 0 deletions
Large diffs are not rendered by default.

leetcode-cn/originData/minimum-amount-of-time-to-collect-garbage.json

Lines changed: 164 additions & 0 deletions
Large diffs are not rendered by default.

leetcode-cn/originData/removing-stars-from-a-string.json

Lines changed: 164 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
<p>给你一个包含若干星号 <code>*</code> 的字符串 <code>s</code></p>
2+
3+
<p>在一步操作中,你可以:</p>
4+
5+
<ul>
6+
<li>选中 <code>s</code> 中的一个星号。</li>
7+
<li>移除星号 <strong>左侧</strong> 最近的那个 <strong>非星号</strong> 字符,并移除该星号自身。</li>
8+
</ul>
9+
10+
<p>返回移除 <strong>所有</strong> 星号之后的字符串<strong></strong></p>
11+
12+
<p><strong>注意:</strong></p>
13+
14+
<ul>
15+
<li>生成的输入保证总是可以执行题面中描述的操作。</li>
16+
<li>可以证明结果字符串是唯一的。</li>
17+
</ul>
18+
19+
<p>&nbsp;</p>
20+
21+
<p><strong>示例 1:</strong></p>
22+
23+
<pre>
24+
<strong>输入:</strong>s = "leet**cod*e"
25+
<strong>输出:</strong>"lecoe"
26+
<strong>解释:</strong>从左到右执行移除操作:
27+
- 距离第 1 个星号最近的字符是 "lee<em><strong>t</strong></em>**cod*e" 中的 't' ,s 变为 "lee*cod*e" 。
28+
- 距离第 2 个星号最近的字符是 "le<em><strong>e</strong></em>*cod*e" 中的 'e' ,s 变为 "lecod*e" 。
29+
- 距离第 3 个星号最近的字符是 "leco<em><strong>d</strong></em>*e" 中的 'd' ,s 变为 "lecoe" 。
30+
不存在其他星号,返回 "lecoe" 。</pre>
31+
32+
<p><strong>示例 2:</strong></p>
33+
34+
<pre>
35+
<strong>输入:</strong>s = "erase*****"
36+
<strong>输出:</strong>""
37+
<strong>解释:</strong>整个字符串都会被移除,所以返回空字符串。
38+
</pre>
39+
40+
<p>&nbsp;</p>
41+
42+
<p><strong>提示:</strong></p>
43+
44+
<ul>
45+
<li><code>1 &lt;= s.length &lt;= 10<sup>5</sup></code></li>
46+
<li><code>s</code> 由小写英文字母和星号 <code>*</code> 组成</li>
47+
<li><code>s</code> 可以执行上述操作</li>
48+
</ul>
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
<p>给你一个长度为 <code>n</code>&nbsp;的整数数组 <code>nums</code> ,和一个长度为 <code>m</code> 的整数数组 <code>queries</code></p>
2+
3+
<p>返回一个长度为 <code>m</code> 的数组<em> </em><code>answer</code><em> </em>,其中<em> </em><code>answer[i]</code><em> </em><code>nums</code><span style=""> </span>元素之和小于等于 <code>queries[i]</code><strong>子序列</strong><strong>最大</strong> 长度<span style="">&nbsp;</span><span style=""> </span></p>
4+
5+
<p><strong>子序列</strong> 是由一个数组删除某些元素(也可以不删除)但不改变剩余元素顺序得到的一个数组。</p>
6+
7+
<p>&nbsp;</p>
8+
9+
<p><strong>示例 1:</strong></p>
10+
11+
<pre>
12+
<strong>输入:</strong>nums = [4,5,2,1], queries = [3,10,21]
13+
<strong>输出:</strong>[2,3,4]
14+
<strong>解释:</strong>queries 对应的 answer 如下:
15+
- 子序列 [2,1] 的和小于或等于 3 。可以证明满足题目要求的子序列的最大长度是 2 ,所以 answer[0] = 2 。
16+
- 子序列 [4,5,1] 的和小于或等于 10 。可以证明满足题目要求的子序列的最大长度是 3 ,所以 answer[1] = 3 。
17+
- 子序列 [4,5,2,1] 的和小于或等于 21 。可以证明满足题目要求的子序列的最大长度是 4 ,所以 answer[2] = 4 。
18+
</pre>
19+
20+
<p><strong>示例 2:</strong></p>
21+
22+
<pre>
23+
<strong>输入:</strong>nums = [2,3,4,5], queries = [1]
24+
<strong>输出:</strong>[0]
25+
<strong>解释:</strong>空子序列是唯一一个满足元素和小于或等于 1 的子序列,所以 answer[0] = 0 。</pre>
26+
27+
<p>&nbsp;</p>
28+
29+
<p><strong>提示:</strong></p>
30+
31+
<ul>
32+
<li><code>n == nums.length</code></li>
33+
<li><code>m == queries.length</code></li>
34+
<li><code>1 &lt;= n, m &lt;= 1000</code></li>
35+
<li><code>1 &lt;= nums[i], queries[i] &lt;= 10<sup>6</sup></code></li>
36+
</ul>
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<p>给你一个下标从 <strong>0</strong>&nbsp;开始的字符串数组&nbsp;<code>garbage</code>&nbsp;,其中&nbsp;<code>garbage[i]</code>&nbsp;表示第 <code>i</code>&nbsp;个房子的垃圾集合。<code>garbage[i]</code>&nbsp;只包含字符&nbsp;<code>'M'</code>&nbsp;,<code>'P'</code> 和&nbsp;<code>'G'</code>&nbsp;,但可能包含多个相同字符,每个字符分别表示一单位的金属、纸和玻璃。垃圾车收拾 <strong></strong>&nbsp;单位的任何一种垃圾都需要花费&nbsp;<code>1</code>&nbsp;分钟。</p>
2+
3+
<p>同时给你一个下标从 <strong>0</strong>&nbsp;开始的整数数组&nbsp;<code>travel</code>&nbsp;,其中&nbsp;<code>travel[i]</code>&nbsp;是垃圾车从房子 <code>i</code>&nbsp;行驶到房子 <code>i + 1</code>&nbsp;需要的分钟数。</p>
4+
5+
<p>城市里总共有三辆垃圾车,分别收拾三种垃圾。每辆垃圾车都从房子 <code>0</code>&nbsp;出发,<strong>按顺序</strong>&nbsp;到达每一栋房子。但它们 <strong>不是必须</strong>&nbsp;到达所有的房子。</p>
6+
7+
<p>任何时刻只有 <strong>一辆</strong>&nbsp;垃圾车处在使用状态。当一辆垃圾车在行驶或者收拾垃圾的时候,另外两辆车 <strong>不能</strong>&nbsp;做任何事情。</p>
8+
9+
<p>请你返回收拾完所有垃圾需要花费的 <strong>最少</strong>&nbsp;总分钟数。</p>
10+
11+
<p>&nbsp;</p>
12+
13+
<p><strong>示例 1:</strong></p>
14+
15+
<pre><b>输入:</b>garbage = ["G","P","GP","GG"], travel = [2,4,3]
16+
<b>输出:</b>21
17+
<strong>解释:</strong>
18+
收拾纸的垃圾车:
19+
1. 从房子 0 行驶到房子 1
20+
2. 收拾房子 1 的纸垃圾
21+
3. 从房子 1 行驶到房子 2
22+
4. 收拾房子 2 的纸垃圾
23+
收拾纸的垃圾车总共花费 8 分钟收拾完所有的纸垃圾。
24+
收拾玻璃的垃圾车:
25+
1. 收拾房子 0 的玻璃垃圾
26+
2. 从房子 0 行驶到房子 1
27+
3. 从房子 1 行驶到房子 2
28+
4. 收拾房子 2 的玻璃垃圾
29+
5. 从房子 2 行驶到房子 3
30+
6. 收拾房子 3 的玻璃垃圾
31+
收拾玻璃的垃圾车总共花费 13 分钟收拾完所有的玻璃垃圾。
32+
由于没有金属垃圾,收拾金属的垃圾车不需要花费任何时间。
33+
所以总共花费 8 + 13 = 21 分钟收拾完所有垃圾。
34+
</pre>
35+
36+
<p><strong>示例 2:</strong></p>
37+
38+
<pre><b>输入:</b>garbage = ["MMM","PGM","GP"], travel = [3,10]
39+
<b>输出:</b>37
40+
<strong>解释:</strong>
41+
收拾金属的垃圾车花费 7 分钟收拾完所有的金属垃圾。
42+
收拾纸的垃圾车花费 15 分钟收拾完所有的纸垃圾。
43+
收拾玻璃的垃圾车花费 15 分钟收拾完所有的玻璃垃圾。
44+
总共花费 7 + 15 + 15 = 37 分钟收拾完所有的垃圾。
45+
</pre>
46+
47+
<p>&nbsp;</p>
48+
49+
<p><strong>提示:</strong></p>
50+
51+
<ul>
52+
<li><code>2 &lt;= garbage.length &lt;= 10<sup>5</sup></code></li>
53+
<li><code>garbage[i]</code> 只包含字母&nbsp;<code>'M'</code>&nbsp;,<code>'P'</code>&nbsp;和&nbsp;<code>'G'</code>&nbsp;。</li>
54+
<li><code>1 &lt;= garbage[i].length &lt;= 10</code></li>
55+
<li><code>travel.length == garbage.length - 1</code></li>
56+
<li><code>1 &lt;= travel[i] &lt;= 100</code></li>
57+
</ul>

0 commit comments

Comments
 (0)