Skip to content

Commit e2c8c36

Browse files
authored
feat: update lc problems (#4609)
1 parent e929b22 commit e2c8c36

File tree

15 files changed

+574
-1
lines changed

15 files changed

+574
-1
lines changed

solution/3500-3599/3566.Partition Array into Two Equal Product Subsets/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: 中等
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3566.Partition%20Array%20into%20Two%20Equal%20Product%20Subsets/README.md
5+
rating: 1459
6+
source: 第 452 场周赛 Q1
57
tags:
68
- 位运算
79
- 递归

solution/3500-3599/3566.Partition Array into Two Equal Product Subsets/README_EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: Medium
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3566.Partition%20Array%20into%20Two%20Equal%20Product%20Subsets/README_EN.md
5+
rating: 1459
6+
source: Weekly Contest 452 Q1
57
tags:
68
- Bit Manipulation
79
- Recursion

solution/3500-3599/3567.Minimum Absolute Difference in Sliding Submatrix/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: 中等
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3567.Minimum%20Absolute%20Difference%20in%20Sliding%20Submatrix/README.md
5+
rating: 1568
6+
source: 第 452 场周赛 Q2
57
tags:
68
- 数组
79
- 矩阵

solution/3500-3599/3567.Minimum Absolute Difference in Sliding Submatrix/README_EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: Medium
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3567.Minimum%20Absolute%20Difference%20in%20Sliding%20Submatrix/README_EN.md
5+
rating: 1568
6+
source: Weekly Contest 452 Q2
57
tags:
68
- Array
79
- Matrix

solution/3500-3599/3568.Minimum Moves to Clean the Classroom/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: 中等
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3568.Minimum%20Moves%20to%20Clean%20the%20Classroom/README.md
5+
rating: 2143
6+
source: 第 452 场周赛 Q3
57
tags:
68
- 位运算
79
- 广度优先搜索

solution/3500-3599/3568.Minimum Moves to Clean the Classroom/README_EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: Medium
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3568.Minimum%20Moves%20to%20Clean%20the%20Classroom/README_EN.md
5+
rating: 2143
6+
source: Weekly Contest 452 Q3
57
tags:
68
- Bit Manipulation
79
- Breadth-First Search

solution/3500-3599/3569.Maximize Count of Distinct Primes After Split/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: 困难
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3569.Maximize%20Count%20of%20Distinct%20Primes%20After%20Split/README.md
5+
rating: 2697
6+
source: 第 452 场周赛 Q4
57
tags:
68
- 线段树
79
- 数组

solution/3500-3599/3569.Maximize Count of Distinct Primes After Split/README_EN.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
comments: true
33
difficulty: Hard
44
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3569.Maximize%20Count%20of%20Distinct%20Primes%20After%20Split/README_EN.md
5+
rating: 2697
6+
source: Weekly Contest 452 Q4
57
tags:
68
- Segment Tree
79
- Array
Lines changed: 183 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,183 @@
1+
---
2+
comments: true
3+
difficulty: 中等
4+
edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3631.Sort%20Threats%20by%20Severity%20and%20Exploitability/README.md
5+
tags:
6+
- 数组
7+
- 排序
8+
---
9+
10+
<!-- problem:start -->
11+
12+
# [3631. 按严重性和可利用性排序威胁 🔒](https://leetcode.cn/problems/sort-threats-by-severity-and-exploitability)
13+
14+
[English Version](/solution/3600-3699/3631.Sort%20Threats%20by%20Severity%20and%20Exploitability/README_EN.md)
15+
16+
## 题目描述
17+
18+
<!-- description:start -->
19+
20+
<p>给定一个二维整数数组&nbsp;<code>threats</code>,其中&nbsp;<code>threats[i] = [ID<sub>i</sub>, sev<sub>i</sub>​, exp<sub>i</sub>]</code>。</p>
21+
22+
<ul>
23+
<li><code>ID<sub>i</sub></code>:威胁的唯一标识。</li>
24+
<li><code>sev<sub>i</sub></code>:表示威胁的严重程度。</li>
25+
<li><code>exp<sub>i</sub></code>:表示威胁的可利用性。</li>
26+
</ul>
27+
28+
<p>威胁 <code>i</code>&nbsp;的 <strong>分数</strong>&nbsp;定义为:<code>score = 2 × sev<sub>i</sub> + exp<sub>i</sub></code></p>
29+
30+
<p>你的任务是按 <strong>分数降序</strong>&nbsp;返回&nbsp;<code>threats</code>。</p>
31+
32+
<p>如果多个威胁具有相同的分数,则按 ID <strong>升序&nbsp;</strong>排序。</p>
33+
34+
<p>&nbsp;</p>
35+
36+
<p><strong class="example">示例 1:</strong></p>
37+
38+
<div class="example-block">
39+
<p><span class="example-io"><b>输入:</b>threats = [[101,2,3],[102,3,2],[103,3,3]]</span></p>
40+
41+
<p><span class="example-io"><b>输出:</b>[[103,3,3],[102,3,2],[101,2,3]]</span></p>
42+
43+
<p><strong>解释:</strong></p>
44+
45+
<table border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="border-collapse:collapse;">
46+
<thead>
47+
<tr>
48+
<th>威胁</th>
49+
<th>ID</th>
50+
<th>sev</th>
51+
<th>exp</th>
52+
<th>分数 = 2 × sev + exp</th>
53+
</tr>
54+
</thead>
55+
<tbody>
56+
<tr>
57+
<td><code>threats[0]</code></td>
58+
<td>101</td>
59+
<td>2</td>
60+
<td>3</td>
61+
<td>2 × 2 + 3 = 7</td>
62+
</tr>
63+
<tr>
64+
<td><code>threats[1]</code></td>
65+
<td>102</td>
66+
<td>3</td>
67+
<td>2</td>
68+
<td>2 × 3 + 2 = 8</td>
69+
</tr>
70+
<tr>
71+
<td><code>threats[2]</code></td>
72+
<td>103</td>
73+
<td>3</td>
74+
<td>3</td>
75+
<td>2 × 3 + 3 = 9</td>
76+
</tr>
77+
</tbody>
78+
</table>
79+
80+
<p>排序顺序:<code>[[103, 3, 3], [102, 3, 2], [101, 2, 3]]</code></p>
81+
</div>
82+
83+
<p><strong class="example">示例 2:</strong></p>
84+
85+
<div class="example-block">
86+
<p><span class="example-io"><b>输入:</b>threats = [[101,4,1],[103,1,5],[102,1,5]]</span></p>
87+
88+
<p><span class="example-io"><b>输出:</b>[[101,4,1],[102,1,5],[103,1,5]]</span></p>
89+
90+
<p><strong>解释:</strong></p>
91+
92+
<table border="1" bordercolor="#ccc" cellpadding="5" cellspacing="0" style="border-collapse:collapse;">
93+
<thead>
94+
<tr>
95+
<th>威胁</th>
96+
<th>ID</th>
97+
<th>sev</th>
98+
<th>exp</th>
99+
<th>分数 = 2 × sev + exp</th>
100+
</tr>
101+
</thead>
102+
<tbody>
103+
<tr>
104+
<td><code>threats[0]</code></td>
105+
<td>101</td>
106+
<td>4</td>
107+
<td>1</td>
108+
<td>2 × 4 + 1 = 9</td>
109+
</tr>
110+
<tr>
111+
<td><code>threats[1]</code></td>
112+
<td>103</td>
113+
<td>1</td>
114+
<td>5</td>
115+
<td>2 × 1 + 5 = 7</td>
116+
</tr>
117+
<tr>
118+
<td><code>threats[2]</code></td>
119+
<td>102</td>
120+
<td>1</td>
121+
<td>5</td>
122+
<td>2 × 1 + 5 = 7</td>
123+
</tr>
124+
</tbody>
125+
</table>
126+
127+
<p><code>threats[1]</code> 与&nbsp;<code>threats[2]</code>&nbsp;有相同的分数,因此它们按升序排序。</p>
128+
129+
<p>排序顺序:<code>[[101, 4, 1], [102, 1, 5], [103, 1, 5]]</code></p>
130+
</div>
131+
132+
<p>&nbsp;</p>
133+
134+
<p><strong>提示:</strong></p>
135+
136+
<ul>
137+
<li><code>1 &lt;= threats.length &lt;= 10<sup>5</sup></code></li>
138+
<li><code>threats[i] == [ID<sub>i</sub>, sev<sub>i</sub>, exp<sub>i</sub>]</code></li>
139+
<li><code>1 &lt;= ID<sub>i</sub> &lt;= 10<sup>6</sup></code></li>
140+
<li><code>1 &lt;= sev<sub>i</sub> &lt;= 10<sup>9</sup></code></li>
141+
<li><code>1 &lt;= exp<sub>i</sub> &lt;= 10<sup>9</sup></code></li>
142+
<li>所有&nbsp;<code>ID<sub>i</sub></code> <strong>互不相同</strong>。</li>
143+
</ul>
144+
145+
<!-- description:end -->
146+
147+
## 解法
148+
149+
<!-- solution:start -->
150+
151+
### 方法一
152+
153+
<!-- tabs:start -->
154+
155+
#### Python3
156+
157+
```python
158+
159+
```
160+
161+
#### Java
162+
163+
```java
164+
165+
```
166+
167+
#### C++
168+
169+
```cpp
170+
171+
```
172+
173+
#### Go
174+
175+
```go
176+
177+
```
178+
179+
<!-- tabs:end -->
180+
181+
<!-- solution:end -->
182+
183+
<!-- problem:end -->

0 commit comments

Comments
 (0)