Skip to content

Commit 1e7b6fe

Browse files
authored
update: 添加问题“3541.找到频率最高的元音和辅音”的代码和题解 (#1127)
* word: en+jp (today+yesterday) (#1126) 题库只到了3539啊看来 * problem(big): 题库更新 - modify的md基本上全看了 time consume: 6394.75444984436 中途休眠了一段时间 AllProblems/1857.有向图中最大颜色值/code.c: what? * 3541: AC.cpp+RE.py (#1126) cpp - AC,100.00%,68.39% * 3541: WA.py (#1126) "successes" * 3541: AC.py+RE.go (#1126) py - AC,75.79%,98.41% * 3541: AC.go+java (#1126) go - AC,100.00%,50.00% java - AC,100.00%,47.79% - final static竟然一遍写对了 rust - AC,100.00%,53.33% * update: 添加问题“3541.找到频率最高的元音和辅音”的代码和题解 (#1127) Signed-off-by: LetMeFly666 <[email protected]> --------- Signed-off-by: LetMeFly666 <[email protected]>
1 parent c7e5241 commit 1e7b6fe

File tree

2,751 files changed

+25640
-510
lines changed

Some content is hidden

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

2,751 files changed

+25640
-510
lines changed

AllProblems/1016.子串能表示从 1 到 N 数字的二进制串/1016.子串能表示从 1 到 N 数字的二进制串.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: 1016.子串能表示从 1 到 N 数字的二进制串
33
date: 2022-06-02 20-02-38
4-
tags: [题解, LeetCode, 中等, 字符串]
4+
tags: [题解, LeetCode, 中等, 位运算, 哈希表, 字符串, 滑动窗口]
55
---
66

77
# 【LetMeFly】1016.子串能表示从 1 到 N 数字的二进制串

AllProblems/1061.按字典序排列最小的等效字符串/1061.按字典序排列最小的等效字符串.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,23 +35,23 @@ tags: [题解, LeetCode, 中等, 并查集, 字符串]
3535
<pre>
3636
<strong>输入:</strong>s1 = "parker", s2 = "morris", baseStr = "parser"
3737
<strong>输出:</strong>"makkek"
38-
<strong>解释:</strong>根据 <code>A</code> 和 <code>B 中的等价信息,</code>我们可以将这些字符分为 <code>[m,p]</code>, <code>[a,o]</code>, <code>[k,r,s]</code>, <code>[e,i] 共 4 组</code>。每组中的字符都是等价的,并按字典序排列。所以答案是 <code>"makkek"</code>。
38+
<strong>解释:</strong>根据 <code>A</code> 和 <code>B</code> 中的等价信息,我们可以将这些字符分为 <code>[m,p]</code>, <code>[a,o]</code>, <code>[k,r,s]</code>, <code>[e,i]</code> 共 4 组。每组中的字符都是等价的,并按字典序排列。所以答案是 <code>"makkek"</code>。
3939
</pre>
4040

4141
<p><strong>示例 2:</strong></p>
4242

4343
<pre>
4444
<strong>输入:</strong>s1 = "hello", s2 = "world", baseStr = "hold"
4545
<strong>输出:</strong>"hdld"
46-
<strong>解释:</strong>根据 <code>A</code> 和 <code>B 中的等价信息,</code>我们可以将这些字符分为 <code>[h,w]</code>, <code>[d,e,o]</code>, <code>[l,r] 共 3 组</code>。所以只有 S 中的第二个字符 <code>'o'</code> 变成 <code>'d',最后答案为 </code><code>"hdld"</code>。
46+
<strong>解释:</strong>根据 <code>A</code> 和 <code>B</code> 中的等价信息,我们可以将这些字符分为 <code>[h,w]</code>, <code>[d,e,o]</code>, <code>[l,r]</code> 共 3 组。所以只有 S 中的第二个字符 <code>'o'</code> 变成 <code>'d'</code>,最后答案为 <code>"hdld"</code>。
4747
</pre>
4848

4949
<p><strong>示例 3:</strong></p>
5050

5151
<pre>
5252
<strong>输入:</strong>s1 = "leetcode", s2 = "programs", baseStr = "sourcecode"
5353
<strong>输出:</strong>"aauaaaaada"
54-
<strong>解释:</strong>我们可以把 AB 中的等价字符分为 <code>[a,o,e,r,s,c]</code>, <code>[l,p]</code>, <code>[g,t]</code> 和 <code>[d,m] 共 4 组</code>,因此 <code>S</code> 中除了 <code>'u'</code> 和 <code>'d'</code> 之外的所有字母都转化成了 <code>'a'</code>,最后答案为 <code>"aauaaaaada"</code>。
54+
<strong>解释:</strong>我们可以把 <code>A</code><code>B</code> 中的等价字符分为 <code>[a,o,e,r,s,c]</code>, <code>[l,p]</code>, <code>[g,t]</code> 和 <code>[d,m]</code> 共 4 组,因此 <code>S</code> 中除了 <code>'u'</code> 和 <code>'d'</code> 之外的所有字母都转化成了 <code>'a'</code>,最后答案为 <code>"aauaaaaada"</code>。
5555
</pre>
5656

5757
<p>&nbsp;</p>

AllProblems/1070.产品销售分析 III/1070.产品销售分析 III.md

Lines changed: 7 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -23,31 +23,21 @@ tags: [题解, LeetCode, 中等, 数据库]
2323
(sale_id, year) 是这张表的主键(具有唯一值的列的组合)。
2424
product_id 是产品表的外键(reference 列)。
2525
这张表的每一行都表示:编号 product_id 的产品在某一年的销售额。
26+
一个产品可能在同一年内有多个销售条目。
2627
请注意,价格是按每单位计的。
2728
</pre>
2829

29-
<p>&nbsp;</p>
30-
31-
<p>产品表&nbsp;<code>Product</code>:</p>
32-
33-
<pre>
34-
+--------------+---------+
35-
| Column Name | Type |
36-
+--------------+---------+
37-
| product_id | int |
38-
| product_name | varchar |
39-
+--------------+---------+
40-
product_id 是这张表的主键(具有唯一值的列)。
41-
这张表的每一行都标识:每个产品的 id 和 产品名称。</pre>
30+
<p>编写解决方案,选出每个售出过的产品&nbsp;<strong>第一年</strong> 销售的 <strong>产品 id</strong>、<strong>年份</strong>、<strong>数量&nbsp;</strong>和 <strong>价格</strong>。</p>
4231

43-
<p>&nbsp;</p>
32+
<ul>
33+
<li>对每个 <code>product_id</code>,找到其在Sales表中首次出现的最早年份。</li>
34+
<li>返回该产品在该年度的 <strong>所有</strong> 销售条目。</li>
35+
</ul>
4436

45-
<p>编写解决方案,选出每个售出过的产品&nbsp;<strong>第一年</strong> 销售的 <strong>产品 id</strong><strong>年份</strong>、<strong>数量&nbsp;</strong>和 <strong>价格</strong>。</p>
37+
<p>返回一张有这些列的表:<strong>product_id</strong><strong>first_year</strong><strong>quantity&nbsp;</strong>和<strong>&nbsp;price</strong>。</p>
4638

4739
<p>结果表中的条目可以按 <strong>任意顺序</strong> 排列。</p>
4840

49-
<p>结果格式如下例所示:</p>
50-
5141
<p>&nbsp;</p>
5242

5343
<p><strong>示例 1:</strong></p>
@@ -62,14 +52,6 @@ Sales 表:
6252
| 2 | 100 | 2009 | 12 | 5000 |
6353
| 7 | 200 | 2011 | 15 | 9000 |
6454
+---------+------------+------+----------+-------+
65-
Product 表:
66-
+------------+--------------+
67-
| product_id | product_name |
68-
+------------+--------------+
69-
| 100 | Nokia |
70-
| 200 | Apple |
71-
| 300 | Samsung |
72-
+------------+--------------+
7355
<strong>输出:</strong>
7456
+------------+------------+----------+-------+
7557
| product_id | first_year | quantity | price |
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
import pandas as pd
22

3-
def sales_analysis(sales: pd.DataFrame, product: pd.DataFrame) -> pd.DataFrame:
3+
def sales_analysis(sales: pd.DataFrame) -> pd.DataFrame:
44

AllProblems/1075.项目员工 I/1075.项目员工 I.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ tags: [题解, LeetCode, 简单, 数据库]
1818
| employee_id | int |
1919
+-------------+---------+
2020
主键为 (project_id, employee_id)。
21-
employee_id 是员工表 <code>Employee 表的外键。</code>
21+
employee_id 是员工表 <code>Employee</code> 表的外键。
2222
这张表的每一行表示 employee_id 的员工正在 project_id 的项目上工作。
2323
</pre>
2424

AllProblems/1094.拼车/1094.拼车.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ tags: [题解, LeetCode, 中等, 数组, 前缀和, 排序, 模拟, 堆(优先
1010

1111
<p>车上最初有&nbsp;<code>capacity</code>&nbsp;个空座位。车&nbsp;<strong>只能&nbsp;</strong>向一个方向行驶(也就是说,<strong>不允许掉头或改变方向</strong>)</p>
1212

13-
<p>给定整数&nbsp;<code>capacity</code>&nbsp;和一个数组 <code>trips</code> , &nbsp;<code>trip[i] = [numPassengers<sub>i</sub>, from<sub>i</sub>, to<sub>i</sub>]</code>&nbsp;表示第 <code>i</code> 次旅行有&nbsp;<code>numPassengers<sub>i</sub></code>&nbsp;乘客,接他们和放他们的位置分别是&nbsp;<code>from<sub>i</sub></code>&nbsp;&nbsp;<code>to<sub>i</sub></code>&nbsp;。这些位置是从汽车的初始位置向东的公里数。</p>
13+
<p>给定整数&nbsp;<code>capacity</code>&nbsp;和一个数组 <code>trips</code> , &nbsp;<code>trips[i] = [numPassengers<sub>i</sub>, from<sub>i</sub>, to<sub>i</sub>]</code>&nbsp;表示第 <code>i</code> 次旅行有&nbsp;<code>numPassengers<sub>i</sub></code>&nbsp;乘客,接他们和放他们的位置分别是&nbsp;<code>from<sub>i</sub></code>&nbsp;&nbsp;<code>to<sub>i</sub></code>&nbsp;。这些位置是从汽车的初始位置向东的公里数。</p>
1414

1515
<p>当且仅当你可以在所有给定的行程中接送所有乘客时,返回&nbsp;<code>true</code>,否则请返回 <code>false</code>。</p>
1616

AllProblems/1117.H2O 生成/code.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ typedef struct {
33

44
} H2O;
55

6+
void releaseHydrogen();
7+
8+
void releaseOxygen();
9+
610
H2O* h2oCreate() {
711
H2O* obj = (H2O*) malloc(sizeof(H2O));
812

AllProblems/1160.拼写单词/1160.拼写单词.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,11 @@ tags: [题解, LeetCode, 简单, 数组, 哈希表, 字符串, 计数]
88

99
力扣题目链接:[https://leetcode.cn/problems/find-words-that-can-be-formed-by-characters/](https://leetcode.cn/problems/find-words-that-can-be-formed-by-characters/)
1010

11-
<p>给你一份『词汇表』(字符串数组)&nbsp;<code>words</code>&nbsp;和一张『字母表』(字符串)&nbsp;<code>chars</code>。</p>
11+
<p>给定一个字符串数组&nbsp;<code>words</code>&nbsp;和一个字符串 <code>chars</code>。</p>
1212

13-
<p>假如你可以用&nbsp;<code>chars</code>&nbsp;中的『字母』(字符)拼写出 <code>words</code>&nbsp;中的某个『单词』(字符串),那么我们就认为你掌握了这个单词。</p>
13+
<p>如果字符串可以由 <code>chars</code> 中的字符组成(每个字符在 <strong>每个</strong>&nbsp;<code>words</code> 中只能使用一次),则认为它是好的。</p>
1414

15-
<p>注意:每次拼写(指拼写词汇表中的一个单词)时,<code>chars</code> 中的每个字母都只能用一次。</p>
16-
17-
<p>返回词汇表&nbsp;<code>words</code>&nbsp;中你掌握的所有单词的 <strong>长度之和</strong>。</p>
15+
<p>返回&nbsp;<code>words</code>&nbsp;中所有好的字符串的长度之和。</p>
1816

1917
<p>&nbsp;</p>
2018

@@ -43,7 +41,7 @@ tags: [题解, LeetCode, 简单, 数组, 哈希表, 字符串, 计数]
4341
<ul>
4442
<li><code>1 &lt;= words.length &lt;= 1000</code></li>
4543
<li><code>1 &lt;= words[i].length, chars.length&nbsp;&lt;= 100</code></li>
46-
<li>所有字符串中都仅包含小写英文字母</li>
44+
<li><code>words[i]</code>&nbsp;和&nbsp;<code>chars</code> 中都仅包含小写英文字母</li>
4745
</ul>
4846

4947

AllProblems/1164.指定日期的产品价格/1164.指定日期的产品价格.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,9 @@ tags: [题解, LeetCode, 中等, 数据库]
2121
(product_id, change_date) 是此表的主键(具有唯一值的列组合)。
2222
这张表的每一行分别记录了 某产品 在某个日期 更改后 的新价格。</pre>
2323

24-
<p>&nbsp;</p>
24+
<p>一开始,所有产品价格都为 10。</p>
2525

26-
<p>编写一个解决方案,找出在&nbsp;<code>2019-08-16</code><strong> </strong>时全部产品的价格,假设所有产品在修改前的价格都是&nbsp;<code>10</code><strong> 。</strong></p>
26+
<p>编写一个解决方案,找出在&nbsp;<code>2019-08-16</code><strong>&nbsp;</strong>所有产品的价格。</p>
2727

2828
<p>以 <strong>任意顺序 </strong>返回结果表。</p>
2929

AllProblems/1290.二进制链表转整数/1290.二进制链表转整数.md

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -12,38 +12,24 @@ tags: [题解, LeetCode, 简单, 链表, 数学]
1212

1313
<p>请你返回该链表所表示数字的 <strong>十进制值</strong> 。</p>
1414

15+
<p><strong>最高位</strong> 在链表的头部。</p>
16+
1517
<p>&nbsp;</p>
1618

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

19-
<p><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/12/15/graph-1.png" style="height: 108px; width: 426px;"></p>
21+
<p><img alt="" src="https://assets.leetcode-cn.com/aliyun-lc-upload/uploads/2019/12/15/graph-1.png" style="height: 108px; width: 426px;" /></p>
2022

21-
<pre><strong>输入:</strong>head = [1,0,1]
23+
<pre>
24+
<strong>输入:</strong>head = [1,0,1]
2225
<strong>输出:</strong>5
2326
<strong>解释:</strong>二进制数 (101) 转化为十进制数 (5)
2427
</pre>
2528

2629
<p><strong>示例 2:</strong></p>
2730

28-
<pre><strong>输入:</strong>head = [0]
29-
<strong>输出:</strong>0
30-
</pre>
31-
32-
<p><strong>示例 3:</strong></p>
33-
34-
<pre><strong>输入:</strong>head = [1]
35-
<strong>输出:</strong>1
36-
</pre>
37-
38-
<p><strong>示例 4:</strong></p>
39-
40-
<pre><strong>输入:</strong>head = [1,0,0,1,0,0,1,1,1,0,0,0,0,0,0]
41-
<strong>输出:</strong>18880
42-
</pre>
43-
44-
<p><strong>示例 5:</strong></p>
45-
46-
<pre><strong>输入:</strong>head = [0,0]
31+
<pre>
32+
<strong>输入:</strong>head = [0]
4733
<strong>输出:</strong>0
4834
</pre>
4935

0 commit comments

Comments
 (0)