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 8777c7f

Browse files
feat: update lc problems (doocs#3666)
1 parent 2e79b90 commit 8777c7f

File tree

9 files changed

+92
-88
lines changed

9 files changed

+92
-88
lines changed

‎solution/0500-0599/0555.Split Concatenated Strings/README_EN.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ tags:
3737
<pre>
3838
<strong>Input:</strong> strs = [&quot;abc&quot;,&quot;xyz&quot;]
3939
<strong>Output:</strong> &quot;zyxcba&quot;
40-
<strong>Explanation:</strong> You can get the looped string &quot;-abcxyz-&quot;, &quot;-abczyx-&quot;, &quot;-cbaxyz-&quot;, &quot;-cbazyx-&quot;, where &#39;-&#39; represents the looped status.
40+
<strong>Explanation:</strong> You can get the looped string &quot;-abcxyz-&quot;, &quot;-abczyx-&quot;, &quot;-cbaxyz-&quot;, &quot;-cbazyx-&quot;, where &#39;-&#39; represents the looped status.
4141
The answer string came from the fourth looped one, where you could cut from the middle character &#39;a&#39; and get &quot;zyxcba&quot;.
4242
</pre>
4343

‎solution/3100-3199/3193.Count the Number of Inversions/README.md‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ tags:
2727
<li><code>i &lt; j</code>&nbsp;且&nbsp;<code>nums[i] &gt; nums[j]</code></li>
2828
</ul>
2929

30-
<p>请你返回&nbsp;<code>[0, 1, 2, ..., n - 1]</code>&nbsp;&nbsp;<span data-keyword="permutation">排列</span> <code>perm</code>&nbsp;的数目,满足对 <strong>所有</strong>&nbsp;&nbsp;<code>requirements[i]</code>&nbsp;都有&nbsp;<code>perm[0..end<sub>i</sub>]</code>&nbsp;恰好有&nbsp;<code>cnt<sub>i</sub></code>&nbsp;个逆序对。</p>
30+
<p>请你返回&nbsp;<code>[0, 1, 2, ..., n - 1]</code>&nbsp;&nbsp;<span data-keyword="permutation">排列</span> <code>perm</code>&nbsp;的数目,满足对 <strong>所有</strong>&nbsp;&nbsp;<code>requirements[i]</code>&nbsp;都满足&nbsp;<code>perm[0..end<sub>i</sub>]</code>&nbsp;中恰好有&nbsp;<code>cnt<sub>i</sub></code>&nbsp;个逆序对。</p>
3131

3232
<p>由于答案可能会很大,将它对&nbsp;<code>10<sup>9</sup> + 7</code>&nbsp;<strong>取余</strong>&nbsp;后返回。</p>
3333

‎solution/3300-3399/3308.Find Top Performing Driver/README.md‎

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ tags:
88

99
<!-- problem:start -->
1010

11-
# [3308. Find Top Performing Driver 🔒](https://leetcode.cn/problems/find-top-performing-driver)
11+
# [3308. 寻找表现最佳的司机 🔒](https://leetcode.cn/problems/find-top-performing-driver)
1212

1313
[English Version](/solution/3300-3399/3308.Find%20Top%20Performing%20Driver/README_EN.md)
1414

1515
## 题目描述
1616

1717
<!-- description:start -->
1818

19-
<p>Table: <font face="monospace"><code>Drivers</code></font></p>
19+
<p>表:<font face="monospace"><code>Drivers</code></font></p>
2020

2121
<pre>
2222
+--------------+---------+
@@ -28,11 +28,11 @@ tags:
2828
| experience | int |
2929
| accidents | int |
3030
+--------------+---------+
31-
(driver_id) is the unique key for this table.
32-
Each row includes a driver&#39;s ID, their name, age, years of driving experience, and the number of accidents they&rsquo;ve had.
31+
(driver_id) 是这张表的唯一主键。
32+
每一行包含一个司机 ID,他们的名字,年龄,驾龄年数,以及事故数。
3333
</pre>
3434

35-
<p>Table: <font face="monospace"><code>Vehicles</code></font></p>
35+
<p>表:<font face="monospace"><code>Vehicles</code></font></p>
3636

3737
<pre>
3838
+--------------+---------+
@@ -42,11 +42,11 @@ Each row includes a driver&#39;s ID, their name, age, years of driving experienc
4242
| fuel_type | varchar |
4343
| mileage | int |
4444
+--------------+---------+
45-
(vehicle_id, driver_id, fuel_type) is the unique key for this table.
46-
Each row includes the vehicle&#39;s ID, the driver who operates it, the model, fuel type, and mileage.
45+
(vehicle_id, driver_id, fuel_type) 是这张表的唯一主键。
46+
每一行包含机动车 ID,驾驶员,车型,动力类型和里程数。
4747
</pre>
4848

49-
<p>Table: <font face="monospace"><code>Trips</code></font></p>
49+
<p>表:<font face="monospace"><code>Trips</code></font></p>
5050

5151
<pre>
5252
+--------------+---------+
@@ -56,29 +56,30 @@ Each row includes the vehicle&#39;s ID, the driver who operates it, the model, f
5656
| duration | int |
5757
| rating | int |
5858
+--------------+---------+
59-
(trip_id) is the unique key for this table.
60-
Each row includes a trip&#39;s ID, the vehicle used, the distance covered (in miles), the trip duration (in minutes), and the passenger&#39;s rating (1-5).
59+
(trip_id) 是这张表的唯一主键。
60+
每一行包含行程 ID,使用的机动车,覆盖的距离(以米计),行程市场(以分钟计),以及乘客评分(1-5)。
6161
</pre>
6262

63-
<p>Uber is analyzing drivers based on their trips. Write a solution to find the <strong>top-performing driver</strong> for <strong>each fuel type</strong> based on the following criteria:</p>
63+
<p>优步正在基于司机的行程分析他们的情况。编写一个解决方案,根据下列标准来找到 <strong>每种动力类型</strong> &nbsp;<strong>表现最好的司机</strong>:</p>
6464

6565
<ol>
66-
<li>A driver&#39;s performance is calculated as the <strong>average rating</strong> across all their trips. Average rating should be rounded to <code>2</code> decimal places.</li>
67-
<li>If two drivers have the same average rating, the driver with the <strong>longer total distance</strong> traveled should be ranked higher.</li>
68-
<li>If there is <strong>still a tie</strong>, choose the driver with the <strong>fewest accidents</strong>.</li>
66+
<li>一个司机的表现由他们行程的 <strong>平均评分</strong>&nbsp;计算。平均评分应该舍入到&nbsp;<code>2</code>&nbsp;位小数。</li>
67+
<li>如果两个司机有相同的平均评分,<strong>里程数更多</strong>&nbsp;的司机评分更高。</li>
68+
<li>如果 <strong>依旧持平</strong>,选择 <strong>事故数最少</strong>&nbsp;的司机。</li>
6969
</ol>
7070

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

73-
<p>The result format is in the following example.</p>
73+
<p>结果格式如下所示。</p>
7474

7575
<p>&nbsp;</p>
76-
<p><strong class="example">Example:</strong></p>
76+
77+
<p><strong class="example">示例:</strong></p>
7778

7879
<div class="example-block">
79-
<p><strong>Input:</strong></p>
80+
<p><strong>输入:</strong></p>
8081

81-
<p><code>Drivers</code> table:</p>
82+
<p><code>Drivers</code> 表:</p>
8283

8384
<pre class="example-io">
8485
+-----------+----------+-----+------------+-----------+
@@ -90,7 +91,7 @@ Each row includes a trip&#39;s ID, the vehicle used, the distance covered (in mi
9091
+-----------+----------+-----+------------+-----------+
9192
</pre>
9293

93-
<p><code>Vehicles</code> table:</p>
94+
<p><code>Vehicles</code> 表:</p>
9495

9596
<pre class="example-io">
9697
+------------+-----------+---------+-----------+---------+
@@ -102,7 +103,7 @@ Each row includes a trip&#39;s ID, the vehicle used, the distance covered (in mi
102103
+------------+-----------+---------+-----------+---------+
103104
</pre>
104105

105-
<p><code>Trips</code> table:</p>
106+
<p><code>Trips</code> 表:</p>
106107

107108
<pre class="example-io">
108109
+---------+------------+----------+----------+--------+
@@ -117,7 +118,7 @@ Each row includes a trip&#39;s ID, the vehicle used, the distance covered (in mi
117118
+---------+------------+----------+----------+--------+
118119
</pre>
119120

120-
<p><strong>Output:</strong></p>
121+
<p><strong>输出:</strong></p>
121122

122123
<pre class="example-io">
123124
+-----------+-----------+--------+----------+
@@ -128,14 +129,14 @@ Each row includes a trip&#39;s ID, the vehicle used, the distance covered (in mi
128129
+-----------+-----------+--------+----------+
129130
</pre>
130131

131-
<p><strong>Explanation:</strong></p>
132+
<p><strong>解释:</strong></p>
132133

133134
<ul>
134-
<li>For fuel type <code>Gasoline</code>, both Alice (Driver 1) and Charlie (Driver 3) have trips. Charlie has an average rating of 5.0, while Alice has 4.5. Therefore, Charlie is selected.</li>
135-
<li>For fuel type <code>Electric</code>, Bob (Driver 2) is the only driver with an average rating of 4.5, so he is selected.</li>
135+
<li>对于动力类型&nbsp;<code>Gasoline</code>,Alice(司机 1)和&nbsp;Charlie(司机 3)有行程。Charlie 平均评分为 5.0,而 Alice 4.5。因此,选择 Charlie</li>
136+
<li>对于动力类型&nbsp;<code>Electric</code>,Bob(司机 2)是唯一的司机,评分为 4.5,因此选择他。</li>
136137
</ul>
137138

138-
<p>The output table is ordered by <code>fuel_type</code> in ascending order.</p>
139+
<p>输出表以&nbsp;<code>fuel_type</code>&nbsp;升序排序。</p>
139140
</div>
140141

141142
<!-- description:end -->

‎solution/3300-3399/3327.Check if DFS Strings Are Palindromes/README.md‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,11 @@ tags:
3939

4040
<ul>
4141
<li>清空字符串&nbsp;<code>dfsStr</code>&nbsp;并调用&nbsp;<code>dfs(i)</code>&nbsp;。</li>
42-
<li>如果结果字符串&nbsp;<code>dfsStr</code>&nbsp;是一个 <strong>回文串</strong>&nbsp;,<code>answer[i]</code>&nbsp;为&nbsp;<code>true</code>&nbsp;,否则&nbsp;<code>answer[i]</code>&nbsp;为&nbsp;<code>false</code>&nbsp;。</li>
42+
<li>如果结果字符串&nbsp;<code>dfsStr</code>&nbsp;是一个 <span data-keyword="palindrome-string">回文串</span>&nbsp;,<code>answer[i]</code>&nbsp;为&nbsp;<code>true</code>&nbsp;,否则&nbsp;<code>answer[i]</code>&nbsp;为&nbsp;<code>false</code>&nbsp;。</li>
4343
</ul>
4444

4545
<p>请你返回字符串&nbsp;<code>answer</code>&nbsp;。</p>
4646

47-
<p><strong>回文串</strong>&nbsp;指的是一个字符串从前往后与从后往前是一模一样的。</p>
48-
4947
<p>&nbsp;</p>
5048

5149
<p><strong class="example">示例 1:</strong></p>

‎solution/3300-3399/3328.Find Cities in Each State II/README.md‎

Lines changed: 31 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ tags:
88

99
<!-- problem:start -->
1010

11-
# [3328. Find Cities in Each State II 🔒](https://leetcode.cn/problems/find-cities-in-each-state-ii)
11+
# [3328. 查找每个州的城市 II 🔒](https://leetcode.cn/problems/find-cities-in-each-state-ii)
1212

1313
[English Version](/solution/3300-3399/3328.Find%20Cities%20in%20Each%20State%20II/README_EN.md)
1414

1515
## 题目描述
1616

1717
<!-- description:start -->
1818

19-
<p>Table: <code>cities</code></p>
19+
<p>表:<code>cities</code></p>
2020

2121
<pre>
2222
+-------------+---------+
@@ -25,29 +25,30 @@ tags:
2525
| state | varchar |
2626
| city | varchar |
2727
+-------------+---------+
28-
(state, city) is the combination of columns with unique values for this table.
29-
Each row of this table contains the state name and the city name within that state.
28+
(state, city) 是这张表中值互不相同的列的组合。
29+
这张表的每一行包含州名和其中的城市名。
3030
</pre>
3131

32-
<p>Write a solution to find <strong>all the cities</strong> in <strong>each state</strong> and analyze them based on the following requirements:</p>
32+
<p>编写一个解决方案来找到 <strong>每个州</strong>&nbsp;中的 <strong>所有城市</strong>&nbsp;并且根据下列条件分析它们:</p>
3333

3434
<ul>
35-
<li>Combine all cities into a <strong>comma-separated</strong> string for each state.</li>
36-
<li>Only include states that have <strong>at least</strong><code>3</code> cities.</li>
37-
<li>Only include states where <strong>at least one city</strong> starts with the <strong>same letter as the state name</strong>.</li>
35+
<li>用 <b>逗号分隔</b>&nbsp;字符串组合每一个州的所有城市。</li>
36+
<li>只显示有 <strong>至少</strong>&nbsp;<code>3</code>&nbsp;个城市的州。</li>
37+
<li>只显示&nbsp;<strong>至少有一个城市</strong>&nbsp;以与 <strong>州名相同字母开头</strong>&nbsp;的州。</li>
3838
</ul>
3939

40-
<p>Return <em>the result table ordered by</em> <em>the count of matching-letter cities in <strong>descending</strong> order</em>&nbsp;<em>and then by state name in <strong>ascending</strong> order</em>.</p>
40+
<p>返回结果表以字母匹配城市的数量 <strong>降序</strong> 排序,然后按州名称 <strong>升序</strong> 排序的结果表。</p>
4141

42-
<p>The result format is in the following example.</p>
42+
<p>结果格式如下所示。</p>
4343

4444
<p>&nbsp;</p>
45-
<p><strong class="example">Example:</strong></p>
45+
46+
<p><strong class="example">示例:</strong></p>
4647

4748
<div class="example-block">
48-
<p><strong>Input:</strong></p>
49+
<p><strong>输入:</strong></p>
4950

50-
<p>cities table:</p>
51+
<p>cities 表:</p>
5152

5253
<pre class="example-io">
5354
+--------------+---------------+
@@ -71,58 +72,58 @@ Each row of this table contains the state name and the city name within that sta
7172
+--------------+---------------+
7273
</pre>
7374

74-
<p><strong>Output:</strong></p>
75+
<p><strong>输出:</strong></p>
7576

7677
<pre class="example-io">
7778
+-------------+-------------------------------------------+-----------------------+
7879
| state | cities | matching_letter_count |
7980
+-------------+-------------------------------------------+-----------------------+
8081
| Pennsylvania| Philadelphia, Pittsburgh, Pottstown | 3 |
81-
| Texas | Dallas, Taylor, Temple, Tyler | 2 |
82+
| Texas | Dallas, Taylor, Temple, Tyler | 3 |
8283
| New York | Buffalo, Newark, New York City, Rochester | 2 |
8384
+-------------+-------------------------------------------+-----------------------+
8485
</pre>
8586

86-
<p><strong>Explanation:</strong></p>
87+
<p><strong>解释:</strong></p>
8788

8889
<ul>
8990
<li><strong>Pennsylvania</strong>:
9091

9192
<ul>
92-
<li>Has 3 cities (meets minimum requirement)</li>
93-
<li>All 3 cities start with &#39;P&#39; (same as state)</li>
93+
<li> 3 个城市(符合最低条件)</li>
94+
<li>所有的 3 个城市都以 'P' 开头(与州相同)</li>
9495
<li>matching_letter_count = 3</li>
9596
</ul>
9697
</li>
9798
<li><strong>Texas</strong>:
9899
<ul>
99-
<li>Has 4 cities (meets minimum requirement)</li>
100-
<li>2 cities (Temple, Tyler) start with &#39;T&#39; (same as state)</li>
101-
<li>matching_letter_count = 2</li>
100+
<li> 4 个城市(符合最低条件)</li>
101+
<li>3 个城市 (Taylor, Temple, Tyler) 以 'T' 开头(与州相同)</li>
102+
<li>matching_letter_count = 3</li>
102103
</ul>
103104
</li>
104105
<li><strong>New York</strong>:
105106
<ul>
106-
<li>Has 4 cities (meets minimum requirement)</li>
107-
<li>2 cities (Newark, New York City) start with &#39;N&#39; (same as state)</li>
107+
<li> 4 个城市(符合最低条件)</li>
108+
<li>2 个城市 (Newark, New York City) 以 'N' 开头(与州相同)</li>
108109
<li>matching_letter_count = 2</li>
109110
</ul>
110111
</li>
111-
<li><strong>California</strong> is not included in the output because:
112+
<li><strong>California</strong> 没有包含在输出表,因为:
112113
<ul>
113-
<li>Although it has 4 cities (meets minimum requirement)</li>
114-
<li>No cities start with &#39;C&#39; (doesn&#39;t meet the matching letter requirement)</li>
114+
<li>尽管它有 4 个城市(符合最低条件)</li>
115+
<li>没有城市以 'C' 开头(不符合字母匹配条件)</li>
115116
</ul>
116117
</li>
117118

118119
</ul>
119120

120-
<p><strong>Note:</strong></p>
121+
<p><strong>注意:</strong></p>
121122

122123
<ul>
123-
<li>Results are ordered by matching_letter_count in descending order</li>
124-
<li>When matching_letter_count is the same (Texas and New York both have 2), they are ordered by state name alphabetically</li>
125-
<li>Cities in each row are ordered alphabetically</li>
124+
<li>结果以 matching_letter_count 降序排序。</li>
125+
<li> matching_letter_count 持平(Texas New York 都为 2),按州名字母序排序。</li>
126+
<li>每一行的城市也以字母序排序。</li>
126127
</ul>
127128
</div>
128129

‎solution/3300-3399/3328.Find Cities in Each State II/README_EN.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ Each row of this table contains the state name and the city name within that sta
7878
| state | cities | matching_letter_count |
7979
+-------------+-------------------------------------------+-----------------------+
8080
| Pennsylvania| Philadelphia, Pittsburgh, Pottstown | 3 |
81-
| Texas | Dallas, Taylor, Temple, Tyler | 2 |
81+
| Texas | Dallas, Taylor, Temple, Tyler | 3 |
8282
| New York | Buffalo, Newark, New York City, Rochester | 2 |
8383
+-------------+-------------------------------------------+-----------------------+
8484
</pre>
@@ -97,8 +97,8 @@ Each row of this table contains the state name and the city name within that sta
9797
<li><strong>Texas</strong>:
9898
<ul>
9999
<li>Has 4 cities (meets minimum requirement)</li>
100-
<li>2 cities (Temple, Tyler) start with &#39;T&#39; (same as state)</li>
101-
<li>matching_letter_count = 2</li>
100+
<li>3 cities (Taylor, Temple, Tyler) start with &#39;T&#39; (same as state)</li>
101+
<li>matching_letter_count = 3</li>
102102
</ul>
103103
</li>
104104
<li><strong>New York</strong>:

0 commit comments

Comments
(0)

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