Skip to content

Commit 311eb3e

Browse files
authored
feat: update lc problems (doocs#2473)
1 parent f66cce2 commit 311eb3e

File tree

34 files changed

+560
-86
lines changed

34 files changed

+560
-86
lines changed

solution/3000-3099/3060.User Activities within Time Bounds/README.md

+18-17
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# [3060. User Activities within Time Bounds](https://leetcode.cn/problems/user-activities-within-time-bounds)
1+
# [3060. 时间范围内的用户活动](https://leetcode.cn/problems/user-activities-within-time-bounds)
22

33
[English Version](/solution/3000-3099/3060.User%20Activities%20within%20Time%20Bounds/README_EN.md)
44

@@ -8,7 +8,7 @@
88

99
<!-- 这里写题目描述 -->
1010

11-
<p>Table: <code>Sessions</code></p>
11+
<p>表:<code>Sessions</code></p>
1212

1313
<pre>
1414
+---------------+----------+
@@ -20,23 +20,24 @@
2020
| session_id | int |
2121
| session_type | enum |
2222
+---------------+----------+
23-
session_id is column of unique values for this table.
24-
session_type is an ENUM (category) type of (Viewer, Streamer).
25-
This table contains user id, session start, session end, session id and session type.
23+
session_id 是这张表中有不同值的列。
24+
session_type 是 (Viewer, Streamer) 的一个 ENUM (category) 类型。
25+
这张表包含 user id, session start, session end, session id session 类型。
2626
</pre>
2727

28-
<p>Write a solution to find the the <strong>users</strong> who have had <strong>at least one</strong> <strong>consecutive session</strong> of the <strong>same</strong> type (either &#39;<strong>Viewer</strong>&#39; or &#39;<strong>Streamer</strong>&#39;) with a <strong>maximum</strong> gap of <code>12</code> hours <strong>between</strong> sessions.</p>
28+
<p>编写一个解决方案,以查找 <strong>至少有一个相同</strong> 类型的 <strong>连续会话</strong>(无论是“<strong>Viewer</strong>”还是“<strong>Streamer</strong>”)的 <strong>用户</strong>,会话 <strong>之间</strong><strong>最大</strong> 间隔为 <code>12</code> 小时。</p>
2929

30-
<p>Return <em>the result table ordered by </em><code>user_id</code><em> in <b>ascending</b> order.</em></p>
30+
<p>返回结果表,以<em>&nbsp;</em><code>user_id</code><em>&nbsp;<strong>升序</strong> 排序。</em></p>
3131

32-
<p>The result format is in the following example.</p>
32+
<p>结果格式如下所述。</p>
3333

3434
<p>&nbsp;</p>
35-
<p><strong class="example">Example:</strong></p>
35+
36+
<p><strong class="example">示例:</strong></p>
3637

3738
<pre>
38-
<strong>Input:</strong>
39-
Sessions table:
39+
<strong>输入:</strong>
40+
Sessions :
4041
+---------+---------------------+---------------------+------------+--------------+
4142
| user_id | session_start | session_end | session_id | session_type |
4243
+---------+---------------------+---------------------+------------+--------------+
@@ -52,18 +53,18 @@ Sessions table:
5253
| 103 | 2023-11-02 20:00:00 | 2023-11-02 23:00:00 | 10 | Viewer |
5354
| 103 | 2023-11-03 09:00:00 | 2023-11-03 10:00:00 | 11 | Viewer |
5455
+---------+---------------------+---------------------+------------+--------------+
55-
<strong>Output:</strong>
56+
<strong>输出:</strong>
5657
+---------+
5758
| user_id |
5859
+---------+
5960
| 102 |
6061
| 103 |
6162
+---------+
62-
<strong>Explanation:</strong>
63-
- User ID 101 will not be included in the final output as they do not have any consecutive sessions of the same session type.
64-
- User ID 102 will be included in the final output as they had two viewer sessions with session IDs 3 and 4, respectively, and the time gap between them was less than 12 hours.
65-
- User ID 103 participated in two viewer sessions with a gap of less than 12 hours between them, identified by session IDs 10 and 11. Therefore, user 103 will be included in the final output.
66-
Output table is ordered by user_id in increasing order.
63+
<strong>解释:</strong>
64+
- 用户 ID 101 将不会包含在最终输出中,因为他们没有相同会话类型的连续回话。
65+
- 用户 ID 102 将会包含在最终输出中,因为他们分别有两个 session ID 为 3 和 4 的 viewer 会话,并且时间间隔在 12 小时内。
66+
- 用户 ID 103 参与了两次 viewer 会话,间隔不到 12 小时,会话 ID 为 10 11。因此,用户 103 将会被包含在最终输出中。
67+
输出表根据 user_id 升序排列。
6768
</pre>
6869

6970
## 解法

solution/3000-3099/3063.Linked List Frequency/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
<!-- 这里写题目描述 -->
1010

11-
<p>给定包含 <code>k</code> 个&nbsp;<strong>不同&nbsp;</strong>元素的链表的&nbsp;<code>head</code>&nbsp;节点,创建一个长度为&nbsp;<code>k</code>&nbsp;的链表,包含给定链表中每个 <strong>不同元素</strong> <strong>任何顺序</strong> 出现的 <span data-keyword="frequency-linkedlist">频率</span>&nbsp;。返回这个链表的头节点。</p>
11+
<p>给定包含 <code>k</code> 个&nbsp;<strong>不同&nbsp;</strong>元素的链表的&nbsp;<code>head</code>&nbsp;节点,创建一个长度为&nbsp;<code>k</code>&nbsp;的链表, <strong>任何顺序</strong> 返回链表中所有 <strong>不同元素</strong> 出现的 <strong>频率</strong>。返回这个链表的头节点。</p>
1212

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

solution/3000-3099/3068.Find the Maximum Sum of Node Values/README.md

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
<p>给你一棵 <code>n</code>&nbsp;个节点的 <strong>无向</strong>&nbsp;树,节点从 <code>0</code>&nbsp;到 <code>n - 1</code>&nbsp;编号。树以长度为 <code>n - 1</code>&nbsp;下标从 <strong>0</strong>&nbsp;开始的二维整数数组 <code>edges</code>&nbsp;的形式给你,其中&nbsp;<code>edges[i] = [u<sub>i</sub>, v<sub>i</sub>]</code>&nbsp;表示树中节点&nbsp;<code>u<sub>i</sub></code>&nbsp;&nbsp;<code>v<sub>i</sub></code>&nbsp;之间有一条边。同时给你一个 <strong>正</strong>&nbsp;整数&nbsp;<code>k</code>&nbsp;和一个长度为 <code>n</code>&nbsp;下标从&nbsp;<strong>0</strong>&nbsp;开始的&nbsp;<strong>非负</strong>&nbsp;整数数组&nbsp;<code>nums</code>&nbsp;,其中&nbsp;<code>nums[i]</code>&nbsp;表示节点 <code>i</code>&nbsp;的 <strong>价值</strong>&nbsp;。</p>
1212

13-
<p>日增哥哥想 <strong>最大化</strong>&nbsp;树中所有节点价值之和。为了实现这一目标,日增哥哥可以执行以下操作 <strong>任意</strong>&nbsp;次(<strong>包括</strong><strong>&nbsp;0 次</strong>):</p>
13+
<p>Alice&nbsp; <strong>最大化</strong>&nbsp;树中所有节点价值之和。为了实现这一目标,Alice 可以执行以下操作 <strong>任意</strong>&nbsp;次(<strong>包括</strong><strong>&nbsp;0 次</strong>):</p>
1414

1515
<ul>
1616
<li>选择连接节点&nbsp;<code>u</code>&nbsp;和&nbsp;<code>v</code>&nbsp;的边&nbsp;<code>[u, v]</code>&nbsp;,并将它们的值更新为:
@@ -23,7 +23,7 @@
2323

2424
</ul>
2525

26-
<p>请你返回日增哥哥通过执行以上操作 <strong>任意次</strong>&nbsp;后,可以得到所有节点 <strong>价值之和</strong>&nbsp;的 <strong>最大值</strong>&nbsp;。</p>
26+
<p>请你返回 Alice 通过执行以上操作 <strong>任意次</strong>&nbsp;后,可以得到所有节点 <strong>价值之和</strong>&nbsp;的 <strong>最大值</strong>&nbsp;。</p>
2727

2828
<p>&nbsp;</p>
2929

@@ -34,7 +34,7 @@
3434
<pre>
3535
<b>输入:</b>nums = [1,2,1], k = 3, edges = [[0,1],[0,2]]
3636
<b>输出:</b>6
37-
<b>解释:</b>日增哥哥可以通过一次操作得到最大价值和 6 :
37+
<b>解释:</b>Alice 可以通过一次操作得到最大价值和 6 :
3838
- 选择边 [0,2] 。nums[0] 和 nums[2] 都变为:1 XOR 3 = 2 ,数组 nums 变为:[1,2,1] -&gt; [2,2,2] 。
3939
所有节点价值之和为 2 + 2 + 2 = 6 。
4040
6 是可以得到最大的价值之和。
@@ -47,7 +47,7 @@
4747
<pre>
4848
<b>输入:</b>nums = [2,3], k = 7, edges = [[0,1]]
4949
<b>输出:</b>9
50-
<b>解释:</b>日增哥哥可以通过一次操作得到最大和 9 :
50+
<b>解释:</b>Alice 可以通过一次操作得到最大和 9 :
5151
- 选择边 [0,1] 。nums[0] 变为:2 XOR 7 = 5 ,nums[1] 变为:3 XOR 7 = 4 ,数组 nums 变为:[2,3] -&gt; [5,4] 。
5252
所有节点价值之和为 5 + 4 = 9 。
5353
9 是可以得到最大的价值之和。
@@ -60,7 +60,7 @@
6060
<pre>
6161
<b>输入:</b>nums = [7,7,7,7,7,7], k = 3, edges = [[0,1],[0,2],[0,3],[0,4],[0,5]]
6262
<b>输出:</b>42
63-
<b>解释:</b>日增哥哥不需要执行任何操作,就可以得到最大价值之和 42 。
63+
<b>解释:</b>Alice 不需要执行任何操作,就可以得到最大价值之和 42 。
6464
</pre>
6565

6666
<p>&nbsp;</p>

solution/3000-3099/3078.Match Alphanumerical Pattern in Matrix I/README.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3000-3099/3078.Match%20Alphanumerical%20Pattern%20in%20Matrix%20I/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:数组,哈希表,字符串,矩阵 -->
66

77
## 题目描述
88

@@ -15,8 +15,8 @@
1515
<p>如果我们能用一些数字(每个 <strong>不同</strong> 的字母对应 <strong>不同</strong> 的数字)替换&nbsp;<code>pattern</code>&nbsp;中包含的字母使得结果矩阵与整数矩阵&nbsp;<code>part</code>&nbsp;相同,我们称整数矩阵&nbsp;<code>part</code>&nbsp;&nbsp;<code>pattern</code>&nbsp;匹配。换句话说,</p>
1616

1717
<ul>
18-
<li>矩阵具有相同的维数。</li>
19-
<li>如果&nbsp;<code>pattern[r][c]</code>&nbsp;是一个数字,那么&nbsp;<code>part[r][c]</code>&nbsp;一定 <strong></strong> 是数字。</li>
18+
<li>这两个矩阵具有相同的维数。</li>
19+
<li>如果&nbsp;<code>pattern[r][c]</code>&nbsp;是一个数字,那么&nbsp;<code>part[r][c]</code>&nbsp;必须是&nbsp;<strong>相同的</strong> 数字。</li>
2020
<li>如果&nbsp;<code>pattern[r][c]</code>&nbsp;是一个字母&nbsp;<code>x</code>:
2121
<ul>
2222
<li>对于每个&nbsp;<code>pattern[i][j] == x</code>,<code>part[i][j]</code>&nbsp;一定与 <code>part[r][c]</code>&nbsp;<strong>相同</strong>。</li>
@@ -25,7 +25,7 @@
2525
</li>
2626
</ul>
2727

28-
<p>返回一个长度为<em>&nbsp;</em><code>2</code>&nbsp;的数组,包含匹配&nbsp;<code>pattern</code>&nbsp;&nbsp;<code>board</code>&nbsp;的子矩阵左上角的行号和列号。如果有一个以上这样的子矩阵,返回行号更小的子矩阵。如果依然相同,则返回列号更小的子矩阵。如果没有符合的答案,返回&nbsp;<code>[-1, -1]</code>。</p>
28+
<p>返回一个长度为<em>&nbsp;</em><code>2</code>&nbsp;的数组,包含匹配&nbsp;<code>pattern</code>&nbsp;&nbsp;<code>board</code>&nbsp;的子矩阵左上角的行号和列号。如果有多个这样的子矩阵,返回行号更小的子矩阵。如果依然有多个,则返回列号更小的子矩阵。如果没有符合的答案,返回&nbsp;<code>[-1, -1]</code>。</p>
2929

3030
<p>&nbsp;</p>
3131

solution/3000-3099/3078.Match Alphanumerical Pattern in Matrix I/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文文档](/solution/3000-3099/3078.Match%20Alphanumerical%20Pattern%20in%20Matrix%20I/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Array,Hash Table,String,Matrix -->
66

77
## Description
88

solution/3000-3099/3079.Find the Sum of Encrypted Integers/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3000-3099/3079.Find%20the%20Sum%20of%20Encrypted%20Integers/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:数组,数学 -->
66

77
## 题目描述
88

solution/3000-3099/3079.Find the Sum of Encrypted Integers/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文文档](/solution/3000-3099/3079.Find%20the%20Sum%20of%20Encrypted%20Integers/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Array,Math -->
66

77
## Description
88

solution/3000-3099/3080.Mark Elements on Array by Performing Queries/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3000-3099/3080.Mark%20Elements%20on%20Array%20by%20Performing%20Queries/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:数组,哈希表,排序,模拟,堆(优先队列) -->
66

77
## 题目描述
88

solution/3000-3099/3080.Mark Elements on Array by Performing Queries/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文文档](/solution/3000-3099/3080.Mark%20Elements%20on%20Array%20by%20Performing%20Queries/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Array,Hash Table,Sorting,Simulation,Heap (Priority Queue) -->
66

77
## Description
88

solution/3000-3099/3081.Replace Question Marks in String to Minimize Its Value/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3000-3099/3081.Replace%20Question%20Marks%20in%20String%20to%20Minimize%20Its%20Value/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:贪心,哈希表,字符串,计数,排序,堆(优先队列) -->
66

77
## 题目描述
88

solution/3000-3099/3081.Replace Question Marks in String to Minimize Its Value/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文文档](/solution/3000-3099/3081.Replace%20Question%20Marks%20in%20String%20to%20Minimize%20Its%20Value/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Greedy,Hash Table,String,Counting,Sorting,Heap (Priority Queue) -->
66

77
## Description
88

solution/3000-3099/3082.Find the Sum of the Power of All Subsequences/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3000-3099/3082.Find%20the%20Sum%20of%20the%20Power%20of%20All%20Subsequences/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:数组,动态规划 -->
66

77
## 题目描述
88

solution/3000-3099/3082.Find the Sum of the Power of All Subsequences/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文文档](/solution/3000-3099/3082.Find%20the%20Sum%20of%20the%20Power%20of%20All%20Subsequences/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Array,Dynamic Programming -->
66

77
## Description
88

solution/3000-3099/3083.Existence of a Substring in a String and Its Reverse/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3000-3099/3083.Existence%20of%20a%20Substring%20in%20a%20String%20and%20Its%20Reverse/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:哈希表,字符串 -->
66

77
## 题目描述
88

solution/3000-3099/3083.Existence of a Substring in a String and Its Reverse/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文文档](/solution/3000-3099/3083.Existence%20of%20a%20Substring%20in%20a%20String%20and%20Its%20Reverse/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Hash Table,String -->
66

77
## Description
88

solution/3000-3099/3084.Count Substrings Starting and Ending with Given Character/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3000-3099/3084.Count%20Substrings%20Starting%20and%20Ending%20with%20Given%20Character/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:数学,字符串,计数 -->
66

77
## 题目描述
88

solution/3000-3099/3084.Count Substrings Starting and Ending with Given Character/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文文档](/solution/3000-3099/3084.Count%20Substrings%20Starting%20and%20Ending%20with%20Given%20Character/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Math,String,Counting -->
66

77
## Description
88

solution/3000-3099/3085.Minimum Deletions to Make String K-Special/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3000-3099/3085.Minimum%20Deletions%20to%20Make%20String%20K-Special/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:贪心,哈希表,字符串,计数,排序 -->
66

77
## 题目描述
88

solution/3000-3099/3085.Minimum Deletions to Make String K-Special/README_EN.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[中文文档](/solution/3000-3099/3085.Minimum%20Deletions%20to%20Make%20String%20K-Special/README.md)
44

5-
<!-- tags: -->
5+
<!-- tags:Greedy,Hash Table,String,Counting,Sorting -->
66

77
## Description
88

solution/3000-3099/3086.Minimum Moves to Pick K Ones/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
[English Version](/solution/3000-3099/3086.Minimum%20Moves%20to%20Pick%20K%20Ones/README_EN.md)
44

5-
<!-- tags: -->
5+
<!-- tags:贪心,数组,前缀和,滑动窗口 -->
66

77
## 题目描述
88

0 commit comments

Comments
 (0)