diff --git a/solution/3500-3599/3566.Partition Array into Two Equal Product Subsets/README.md b/solution/3500-3599/3566.Partition Array into Two Equal Product Subsets/README.md index cc27e795dbf1b..61f15c194eab2 100644 --- a/solution/3500-3599/3566.Partition Array into Two Equal Product Subsets/README.md +++ b/solution/3500-3599/3566.Partition Array into Two Equal Product Subsets/README.md @@ -2,6 +2,8 @@ comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3566.Partition%20Array%20into%20Two%20Equal%20Product%20Subsets/README.md +rating: 1459 +source: 第 452 场周赛 Q1 tags: - 位运算 - 递归 diff --git a/solution/3500-3599/3566.Partition Array into Two Equal Product Subsets/README_EN.md b/solution/3500-3599/3566.Partition Array into Two Equal Product Subsets/README_EN.md index e7ca5c9127003..2f6e750aaf703 100644 --- a/solution/3500-3599/3566.Partition Array into Two Equal Product Subsets/README_EN.md +++ b/solution/3500-3599/3566.Partition Array into Two Equal Product Subsets/README_EN.md @@ -2,6 +2,8 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3566.Partition%20Array%20into%20Two%20Equal%20Product%20Subsets/README_EN.md +rating: 1459 +source: Weekly Contest 452 Q1 tags: - Bit Manipulation - Recursion diff --git a/solution/3500-3599/3567.Minimum Absolute Difference in Sliding Submatrix/README.md b/solution/3500-3599/3567.Minimum Absolute Difference in Sliding Submatrix/README.md index 78f679fb3d1e7..64731cb830f3c 100644 --- a/solution/3500-3599/3567.Minimum Absolute Difference in Sliding Submatrix/README.md +++ b/solution/3500-3599/3567.Minimum Absolute Difference in Sliding Submatrix/README.md @@ -2,6 +2,8 @@ comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3567.Minimum%20Absolute%20Difference%20in%20Sliding%20Submatrix/README.md +rating: 1568 +source: 第 452 场周赛 Q2 tags: - 数组 - 矩阵 diff --git a/solution/3500-3599/3567.Minimum Absolute Difference in Sliding Submatrix/README_EN.md b/solution/3500-3599/3567.Minimum Absolute Difference in Sliding Submatrix/README_EN.md index 2a23d341024c1..02fa0f9c36108 100644 --- a/solution/3500-3599/3567.Minimum Absolute Difference in Sliding Submatrix/README_EN.md +++ b/solution/3500-3599/3567.Minimum Absolute Difference in Sliding Submatrix/README_EN.md @@ -2,6 +2,8 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3567.Minimum%20Absolute%20Difference%20in%20Sliding%20Submatrix/README_EN.md +rating: 1568 +source: Weekly Contest 452 Q2 tags: - Array - Matrix diff --git a/solution/3500-3599/3568.Minimum Moves to Clean the Classroom/README.md b/solution/3500-3599/3568.Minimum Moves to Clean the Classroom/README.md index c9206a5a0f12f..5d34037183a09 100644 --- a/solution/3500-3599/3568.Minimum Moves to Clean the Classroom/README.md +++ b/solution/3500-3599/3568.Minimum Moves to Clean the Classroom/README.md @@ -2,6 +2,8 @@ comments: true difficulty: 中等 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3568.Minimum%20Moves%20to%20Clean%20the%20Classroom/README.md +rating: 2143 +source: 第 452 场周赛 Q3 tags: - 位运算 - 广度优先搜索 diff --git a/solution/3500-3599/3568.Minimum Moves to Clean the Classroom/README_EN.md b/solution/3500-3599/3568.Minimum Moves to Clean the Classroom/README_EN.md index 5bc325f17e53c..a097504eec875 100644 --- a/solution/3500-3599/3568.Minimum Moves to Clean the Classroom/README_EN.md +++ b/solution/3500-3599/3568.Minimum Moves to Clean the Classroom/README_EN.md @@ -2,6 +2,8 @@ comments: true difficulty: Medium edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3568.Minimum%20Moves%20to%20Clean%20the%20Classroom/README_EN.md +rating: 2143 +source: Weekly Contest 452 Q3 tags: - Bit Manipulation - Breadth-First Search diff --git a/solution/3500-3599/3569.Maximize Count of Distinct Primes After Split/README.md b/solution/3500-3599/3569.Maximize Count of Distinct Primes After Split/README.md index 7d1f537794cde..3d1be43cd9a7b 100644 --- a/solution/3500-3599/3569.Maximize Count of Distinct Primes After Split/README.md +++ b/solution/3500-3599/3569.Maximize Count of Distinct Primes After Split/README.md @@ -2,6 +2,8 @@ comments: true difficulty: 困难 edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3569.Maximize%20Count%20of%20Distinct%20Primes%20After%20Split/README.md +rating: 2697 +source: 第 452 场周赛 Q4 tags: - 线段树 - 数组 diff --git a/solution/3500-3599/3569.Maximize Count of Distinct Primes After Split/README_EN.md b/solution/3500-3599/3569.Maximize Count of Distinct Primes After Split/README_EN.md index 4a4577cf6e439..2ad867e94e2f0 100644 --- a/solution/3500-3599/3569.Maximize Count of Distinct Primes After Split/README_EN.md +++ b/solution/3500-3599/3569.Maximize Count of Distinct Primes After Split/README_EN.md @@ -2,6 +2,8 @@ comments: true difficulty: Hard edit_url: https://github.com/doocs/leetcode/edit/main/solution/3500-3599/3569.Maximize%20Count%20of%20Distinct%20Primes%20After%20Split/README_EN.md +rating: 2697 +source: Weekly Contest 452 Q4 tags: - Segment Tree - Array diff --git a/solution/3600-3699/3631.Sort Threats by Severity and Exploitability/README.md b/solution/3600-3699/3631.Sort Threats by Severity and Exploitability/README.md new file mode 100644 index 0000000000000..48864e35833c6 --- /dev/null +++ b/solution/3600-3699/3631.Sort Threats by Severity and Exploitability/README.md @@ -0,0 +1,183 @@ +--- +comments: true +difficulty: 中等 +edit_url: https://github.com/doocs/leetcode/edit/main/solution/3600-3699/3631.Sort%20Threats%20by%20Severity%20and%20Exploitability/README.md +tags: + - 数组 + - 排序 +--- + + + +# [3631. 按严重性和可利用性排序威胁 🔒](https://leetcode.cn/problems/sort-threats-by-severity-and-exploitability) + +[English Version](/solution/3600-3699/3631.Sort%20Threats%20by%20Severity%20and%20Exploitability/README_EN.md) + +## 题目描述 + + + +
给定一个二维整数数组 threats
,其中 threats[i] = [IDi, sevi, expi]
。
IDi
:威胁的唯一标识。sevi
:表示威胁的严重程度。expi
:表示威胁的可利用性。威胁 i
的 分数 定义为:score = 2 × sevi + expi
你的任务是按 分数降序 返回 threats
。
如果多个威胁具有相同的分数,则按 ID 升序 排序。
+ ++ +
示例 1:
+ +输入:threats = [[101,2,3],[102,3,2],[103,3,3]]
+ +输出:[[103,3,3],[102,3,2],[101,2,3]]
+ +解释:
+ +威胁 | +ID | +sev | +exp | +分数 = 2 × sev + exp | +
---|---|---|---|---|
threats[0] |
+ 101 | +2 | +3 | +2 × 2 + 3 = 7 | +
threats[1] |
+ 102 | +3 | +2 | +2 × 3 + 2 = 8 | +
threats[2] |
+ 103 | +3 | +3 | +2 × 3 + 3 = 9 | +
排序顺序:[[103, 3, 3], [102, 3, 2], [101, 2, 3]]
示例 2:
+ +输入:threats = [[101,4,1],[103,1,5],[102,1,5]]
+ +输出:[[101,4,1],[102,1,5],[103,1,5]]
+ +解释:
+ +威胁 | +ID | +sev | +exp | +分数 = 2 × sev + exp | +
---|---|---|---|---|
threats[0] |
+ 101 | +4 | +1 | +2 × 4 + 1 = 9 | +
threats[1] |
+ 103 | +1 | +5 | +2 × 1 + 5 = 7 | +
threats[2] |
+ 102 | +1 | +5 | +2 × 1 + 5 = 7 | +
threats[1]
与 threats[2]
有相同的分数,因此它们按升序排序。
排序顺序:[[101, 4, 1], [102, 1, 5], [103, 1, 5]]
+ +
提示:
+ +1 <= threats.length <= 105
threats[i] == [IDi, sevi, expi]
1 <= IDi <= 106
1 <= sevi <= 109
1 <= expi <= 109
IDi
互不相同。You are given a 2D integer array threats
, where each threats[i] = [IDi, sevi, expi]
IDi
: Unique identifier of the threat.sevi
: Indicates the severity of the threat.expi
: Indicates the exploitability of the threat.The score of a threat i
is defined as: score = 2 × sevi + expi
Your task is to return threats
sorted in descending order of score.
If multiple threats have the same score, sort them by ascending ID.
+ ++
Example 1:
+ +Input: threats = [[101,2,3],[102,3,2],[103,3,3]]
+ +Output: [[103,3,3],[102,3,2],[101,2,3]]
+ +Explanation:
+ +Threat | +ID | +sev | +exp | +Score = 2 × sev + exp | +
---|---|---|---|---|
threats[0] |
+ 101 | +2 | +3 | +2 × 2 + 3 = 7 | +
threats[1] |
+ 102 | +3 | +2 | +2 × 3 + 2 = 8 | +
threats[2] |
+ 103 | +3 | +3 | +2 × 3 + 3 = 9 | +
Sorted Order: [[103, 3, 3], [102, 3, 2], [101, 2, 3]]
Example 2:
+ +Input: threats = [[101,4,1],[103,1,5],[102,1,5]]
+ +Output: [[101,4,1],[102,1,5],[103,1,5]]
+ +Explanation:
+ +Threat | +ID | +sev | +exp | +Score = 2 × sev + exp | +
---|---|---|---|---|
threats[0] |
+ 101 | +4 | +1 | +2 × 4 + 1 = 9 | +
threats[1] |
+ 103 | +1 | +5 | +2 × 1 + 5 = 7 | +
threats[2] |
+ 102 | +1 | +5 | +2 × 1 + 5 = 7 | +
threats[1]
and threats[2]
have same score, thus sort them by ascending ID.
Sorted Order: [[101, 4, 1], [102, 1, 5], [103, 1, 5]]
+
Constraints:
+ +1 <= threats.length <= 105
threats[i] == [IDi, sevi, expi]
1 <= IDi <= 106
1 <= sevi <= 109
1 <= expi <= 109
IDi
are unique给你一个长度为 n
的正整数数组 nums
和一个非负整数 k
。
返回所有元素按位异或结果 大于 或 等于 k
的 连续子数组 的数目。
+ +
示例 1:
+ +输入: nums = [3,1,2,3], k = 2
+ +输出: 6
+ +解释:
+ +满足 XOR >= 2
的子数组包括:下标 0 处的 [3]
,下标 0 - 1 处的 [3, 1]
,下标 0 - 3 处的 [3, 1, 2, 3]
,下标 1 - 2 处的 [1, 2]
,下标 2 处的 [2]
,以及下标 3 处的 [3]
;总共有 6 个。
示例 2:
+ +输入: nums = [0,0,0], k = 0
+ +输出: 6
+ +解释:
+ +每个连续子数组的 XOR = 0
,满足 k = 0
。总共有 6 个这样的子数组。
+ +
提示:
+ +1 <= nums.length <= 105
0 <= nums[i] <= 109
0 <= k <= 109
Given an array of positive integers nums
of length n
and a non‑negative integer k
.
Return the number of contiguous subarrays whose bitwise XOR of all elements is greater than or equal to k
.
+
Example 1:
+ +Input: nums = [3,1,2,3], k = 2
+ +Output: 6
+ +Explanation:
+ +The valid subarrays with XOR >= 2
are [3]
at index 0, [3, 1]
at indices 0 - 1, [3, 1, 2, 3]
at indices 0 - 3, [1, 2]
at indices 1 - 2, [2]
at index 2, and [3]
at index 3; there are 6 in total.
Example 2:
+ +Input: nums = [0,0,0], k = 0
+ +Output: 6
+ +Explanation:
+ +Every contiguous subarray yields XOR = 0
, which meets k = 0
. There are 6 such subarrays in total.
+
Constraints:
+ +1 <= nums.length <= 105
0 <= nums[i] <= 109
0 <= k <= 109