diff --git a/solution/2900-2999/2913.Subarrays Distinct Element Sum of Squares I/README.md b/solution/2900-2999/2913.Subarrays Distinct Element Sum of Squares I/README.md new file mode 100644 index 0000000000000..74df06f8ac071 --- /dev/null +++ b/solution/2900-2999/2913.Subarrays Distinct Element Sum of Squares I/README.md @@ -0,0 +1,101 @@ +# [2913. 子数组不同元素数目的平方和 I](https://leetcode.cn/problems/subarrays-distinct-element-sum-of-squares-i) + +[English Version](/solution/2900-2999/2913.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20I/README_EN.md) + +## 题目描述 + + + +

给你一个下标从 0 开始的整数数组 nums 。

+ +

定义 nums 一个子数组的 不同计数 值如下:

+ + + +

请你返回 nums 中所有子数组的 不同计数 的 平方 和。

+ +

由于答案可能会很大,请你将它对 109 + 7 取余 后返回。

+ +

子数组指的是一个数组里面一段连续 非空 的元素序列。

+ +

 

+ +

示例 1:

+ +
+输入:nums = [1,2,1]
+输出:15
+解释:六个子数组分别为:
+[1]: 1 个互不相同的元素。
+[2]: 1 个互不相同的元素。
+[1]: 1 个互不相同的元素。
+[1,2]: 2 个互不相同的元素。
+[2,1]: 2 个互不相同的元素。
+[1,2,1]: 2 个互不相同的元素。
+所有不同计数的平方和为 12 + 12 + 12 + 22 + 22 + 22 = 15 。
+
+ +

示例 2:

+ +
+输入:nums = [2,2]
+输出:3
+解释:三个子数组分别为:
+[2]: 1 个互不相同的元素。
+[2]: 1 个互不相同的元素。
+[2,2]: 1 个互不相同的元素。
+所有不同计数的平方和为 12 + 12 + 12 = 3 。
+
+ +

 

+ +

提示:

+ + + +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2913.Subarrays Distinct Element Sum of Squares I/README_EN.md b/solution/2900-2999/2913.Subarrays Distinct Element Sum of Squares I/README_EN.md new file mode 100644 index 0000000000000..db319da3a4143 --- /dev/null +++ b/solution/2900-2999/2913.Subarrays Distinct Element Sum of Squares I/README_EN.md @@ -0,0 +1,88 @@ +# [2913. Subarrays Distinct Element Sum of Squares I](https://leetcode.com/problems/subarrays-distinct-element-sum-of-squares-i) + +[中文文档](/solution/2900-2999/2913.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20I/README.md) + +## Description + +

You are given a 0-indexed integer array nums.

+ +

The distinct count of a subarray of nums is defined as:

+ + + +

Return the sum of the squares of distinct counts of all subarrays of nums.

+ +

A subarray is a contiguous non-empty sequence of elements within an array.

+ +

 

+

Example 1:

+ +
+Input: nums = [1,2,1]
+Output: 15
+Explanation: Six possible subarrays are:
+[1]: 1 distinct value
+[2]: 1 distinct value
+[1]: 1 distinct value
+[1,2]: 2 distinct values
+[2,1]: 2 distinct values
+[1,2,1]: 2 distinct values
+The sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 + 22 + 22 + 22 = 15.
+
+ +

Example 2:

+ +
+Input: nums = [1,1]
+Output: 3
+Explanation: Three possible subarrays are:
+[1]: 1 distinct value
+[1]: 1 distinct value
+[1,1]: 1 distinct value
+The sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 = 3.
+ +

 

+

Constraints:

+ + + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2914.Minimum Number of Changes to Make Binary String Beautiful/README.md b/solution/2900-2999/2914.Minimum Number of Changes to Make Binary String Beautiful/README.md new file mode 100644 index 0000000000000..3e456c39dcfca --- /dev/null +++ b/solution/2900-2999/2914.Minimum Number of Changes to Make Binary String Beautiful/README.md @@ -0,0 +1,102 @@ +# [2914. 使二进制字符串变美丽的最少修改次数](https://leetcode.cn/problems/minimum-number-of-changes-to-make-binary-string-beautiful) + +[English Version](/solution/2900-2999/2914.Minimum%20Number%20of%20Changes%20to%20Make%20Binary%20String%20Beautiful/README_EN.md) + +## 题目描述 + + + +

给你一个长度为偶数下标从 0 开始的二进制字符串 s 。

+ +

如果可以将一个字符串分割成一个或者更多满足以下条件的子字符串,那么我们称这个字符串是 美丽的 :

+ + + +

你可以将 s 中任一字符改成 0 或者 1 。

+ +

请你返回让字符串 s 美丽的 最少 字符修改次数。

+ +

 

+ +

示例 1:

+ +
+输入:s = "1001"
+输出:2
+解释:我们将 s[1] 改为 1 ,且将 s[3] 改为 0 ,得到字符串 "1100" 。
+字符串 "1100" 是美丽的,因为我们可以将它分割成 "11|00" 。
+将字符串变美丽最少需要 2 次修改。
+
+ +

示例 2:

+ +
+输入:s = "10"
+输出:1
+解释:我们将 s[1] 改为 1 ,得到字符串 "11" 。
+字符串 "11" 是美丽的,因为它已经是美丽的。
+将字符串变美丽最少需要 1 次修改。
+
+ +

示例 3:

+ +
+输入:s = "0000"
+输出:0
+解释:不需要进行任何修改,字符串 "0000" 已经是美丽字符串。
+
+ +

 

+ +

提示:

+ + + +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2914.Minimum Number of Changes to Make Binary String Beautiful/README_EN.md b/solution/2900-2999/2914.Minimum Number of Changes to Make Binary String Beautiful/README_EN.md new file mode 100644 index 0000000000000..85a086dc7af46 --- /dev/null +++ b/solution/2900-2999/2914.Minimum Number of Changes to Make Binary String Beautiful/README_EN.md @@ -0,0 +1,92 @@ +# [2914. Minimum Number of Changes to Make Binary String Beautiful](https://leetcode.com/problems/minimum-number-of-changes-to-make-binary-string-beautiful) + +[中文文档](/solution/2900-2999/2914.Minimum%20Number%20of%20Changes%20to%20Make%20Binary%20String%20Beautiful/README.md) + +## Description + +

You are given a 0-indexed binary string s having an even length.

+ +

A string is beautiful if it's possible to partition it into one or more substrings such that:

+ + + +

You can change any character in s to 0 or 1.

+ +

Return the minimum number of changes required to make the string s beautiful.

+ +

 

+

Example 1:

+ +
+Input: s = "1001"
+Output: 2
+Explanation: We change s[1] to 1 and s[3] to 0 to get string "1100".
+It can be seen that the string "1100" is beautiful because we can partition it into "11|00".
+It can be proven that 2 is the minimum number of changes needed to make the string beautiful.
+
+ +

Example 2:

+ +
+Input: s = "10"
+Output: 1
+Explanation: We change s[1] to 1 to get string "11".
+It can be seen that the string "11" is beautiful because we can partition it into "11".
+It can be proven that 1 is the minimum number of changes needed to make the string beautiful.
+
+ +

Example 3:

+ +
+Input: s = "0000"
+Output: 0
+Explanation: We don't need to make any changes as the string "0000" is beautiful already.
+
+ +

 

+

Constraints:

+ + + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2915.Length of the Longest Subsequence That Sums to Target/README.md b/solution/2900-2999/2915.Length of the Longest Subsequence That Sums to Target/README.md new file mode 100644 index 0000000000000..72c90594de2f8 --- /dev/null +++ b/solution/2900-2999/2915.Length of the Longest Subsequence That Sums to Target/README.md @@ -0,0 +1,91 @@ +# [2915. 和为目标值的最长子序列的长度](https://leetcode.cn/problems/length-of-the-longest-subsequence-that-sums-to-target) + +[English Version](/solution/2900-2999/2915.Length%20of%20the%20Longest%20Subsequence%20That%20Sums%20to%20Target/README_EN.md) + +## 题目描述 + + + +

给你一个下标从 0 开始的整数数组 nums 和一个整数 target 。

+ +

返回和为 target 的 nums 子序列中,子序列 长度的最大值 。如果不存在和为 target 的子序列,返回 -1 。

+ +

子序列 指的是从原数组中删除一些或者不删除任何元素后,剩余元素保持原来的顺序构成的数组。

+ +

 

+ +

示例 1:

+ +
+输入:nums = [1,2,3,4,5], target = 9
+输出:3
+解释:总共有 3 个子序列的和为 9 :[4,5] ,[1,3,5] 和 [2,3,4] 。最长的子序列是 [1,3,5] 和 [2,3,4] 。所以答案为 3 。
+
+ +

示例 2:

+ +
+输入:nums = [4,1,3,2,1,5], target = 7
+输出:4
+解释:总共有 5 个子序列的和为 7 :[4,3] ,[4,1,2] ,[4,2,1] ,[1,1,5] 和 [1,3,2,1] 。最长子序列为 [1,3,2,1] 。所以答案为 4 。
+
+ +

示例 3:

+ +
+输入:nums = [1,1,5,4,5], target = 3
+输出:-1
+解释:无法得到和为 3 的子序列。
+
+ +

 

+ +

提示:

+ + + +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2915.Length of the Longest Subsequence That Sums to Target/README_EN.md b/solution/2900-2999/2915.Length of the Longest Subsequence That Sums to Target/README_EN.md new file mode 100644 index 0000000000000..5903ef24b1248 --- /dev/null +++ b/solution/2900-2999/2915.Length of the Longest Subsequence That Sums to Target/README_EN.md @@ -0,0 +1,81 @@ +# [2915. Length of the Longest Subsequence That Sums to Target](https://leetcode.com/problems/length-of-the-longest-subsequence-that-sums-to-target) + +[中文文档](/solution/2900-2999/2915.Length%20of%20the%20Longest%20Subsequence%20That%20Sums%20to%20Target/README.md) + +## Description + +

You are given a 0-indexed array of integers nums, and an integer target.

+ +

Return the length of the longest subsequence of nums that sums up to target. If no such subsequence exists, return -1.

+ +

A subsequence is an array that can be derived from another array by deleting some or no elements without changing the order of the remaining elements.

+ +

 

+

Example 1:

+ +
+Input: nums = [1,2,3,4,5], target = 9
+Output: 3
+Explanation: There are 3 subsequences with a sum equal to 9: [4,5], [1,3,5], and [2,3,4]. The longest subsequences are [1,3,5], and [2,3,4]. Hence, the answer is 3.
+
+ +

Example 2:

+ +
+Input: nums = [4,1,3,2,1,5], target = 7
+Output: 4
+Explanation: There are 5 subsequences with a sum equal to 7: [4,3], [4,1,2], [4,2,1], [1,1,5], and [1,3,2,1]. The longest subsequence is [1,3,2,1]. Hence, the answer is 4.
+
+ +

Example 3:

+ +
+Input: nums = [1,1,5,4,5], target = 3
+Output: -1
+Explanation: It can be shown that nums has no subsequence that sums up to 3.
+
+ +

 

+

Constraints:

+ + + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2916.Subarrays Distinct Element Sum of Squares II/README.md b/solution/2900-2999/2916.Subarrays Distinct Element Sum of Squares II/README.md new file mode 100644 index 0000000000000..71ece64bd758c --- /dev/null +++ b/solution/2900-2999/2916.Subarrays Distinct Element Sum of Squares II/README.md @@ -0,0 +1,101 @@ +# [2916. 子数组不同元素数目的平方和 II](https://leetcode.cn/problems/subarrays-distinct-element-sum-of-squares-ii) + +[English Version](/solution/2900-2999/2916.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20II/README_EN.md) + +## 题目描述 + + + +

给你一个下标从 0 开始的整数数组 nums 。

+ +

定义 nums 一个子数组的 不同计数 值如下:

+ + + +

请你返回 nums 中所有子数组的 不同计数 的 平方 和。

+ +

由于答案可能会很大,请你将它对 109 + 7 取余 后返回。

+ +

子数组指的是一个数组里面一段连续 非空 的元素序列。

+ +

 

+ +

示例 1:

+ +
+输入:nums = [1,2,1]
+输出:15
+解释:六个子数组分别为:
+[1]: 1 个互不相同的元素。
+[2]: 1 个互不相同的元素。
+[1]: 1 个互不相同的元素。
+[1,2]: 2 个互不相同的元素。
+[2,1]: 2 个互不相同的元素。
+[1,2,1]: 2 个互不相同的元素。
+所有不同计数的平方和为 12 + 12 + 12 + 22 + 22 + 22 = 15 。
+
+ +

示例 2:

+ +
+输入:nums = [2,2]
+输出:3
+解释:三个子数组分别为:
+[2]: 1 个互不相同的元素。
+[2]: 1 个互不相同的元素。
+[2,2]: 1 个互不相同的元素。
+所有不同计数的平方和为 12 + 12 + 12 = 3 。
+
+ +

 

+ +

提示:

+ + + +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2916.Subarrays Distinct Element Sum of Squares II/README_EN.md b/solution/2900-2999/2916.Subarrays Distinct Element Sum of Squares II/README_EN.md new file mode 100644 index 0000000000000..45a8a9a509223 --- /dev/null +++ b/solution/2900-2999/2916.Subarrays Distinct Element Sum of Squares II/README_EN.md @@ -0,0 +1,90 @@ +# [2916. Subarrays Distinct Element Sum of Squares II](https://leetcode.com/problems/subarrays-distinct-element-sum-of-squares-ii) + +[中文文档](/solution/2900-2999/2916.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20II/README.md) + +## Description + +

You are given a 0-indexed integer array nums.

+ +

The distinct count of a subarray of nums is defined as:

+ + + +

Return the sum of the squares of distinct counts of all subarrays of nums.

+ +

Since the answer may be very large, return it modulo 109 + 7.

+ +

A subarray is a contiguous non-empty sequence of elements within an array.

+ +

 

+

Example 1:

+ +
+Input: nums = [1,2,1]
+Output: 15
+Explanation: Six possible subarrays are:
+[1]: 1 distinct value
+[2]: 1 distinct value
+[1]: 1 distinct value
+[1,2]: 2 distinct values
+[2,1]: 2 distinct values
+[1,2,1]: 2 distinct values
+The sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 + 22 + 22 + 22 = 15.
+
+ +

Example 2:

+ +
+Input: nums = [2,2]
+Output: 3
+Explanation: Three possible subarrays are:
+[2]: 1 distinct value
+[2]: 1 distinct value
+[2,2]: 1 distinct value
+The sum of the squares of the distinct counts in all subarrays is equal to 12 + 12 + 12 = 3.
+ +

 

+

Constraints:

+ + + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2917.Find the K-or of an Array/README.md b/solution/2900-2999/2917.Find the K-or of an Array/README.md new file mode 100644 index 0000000000000..10fe261d86620 --- /dev/null +++ b/solution/2900-2999/2917.Find the K-or of an Array/README.md @@ -0,0 +1,100 @@ +# [2917. 找出数组中的 K-or 值](https://leetcode.cn/problems/find-the-k-or-of-an-array) + +[English Version](/solution/2900-2999/2917.Find%20the%20K-or%20of%20an%20Array/README_EN.md) + +## 题目描述 + + + +

给你一个下标从 0 开始的整数数组 nums 和一个整数 k

+ +

nums 中的 K-or 是一个满足以下条件的非负整数:

+ + + +

返回 numsK-or 值。

+ +

注意 :对于整数 x ,如果 (2i AND x) == 2i ,则 x 中的第 i 位值为 1 ,其中 AND 为按位与运算符。

+ +

 

+ +

示例 1:

+ +
+输入:nums = [7,12,9,8,9,15], k = 4
+输出:9
+解释:nums[0]、nums[2]、nums[4] 和 nums[5] 的第 0 位的值为 1 。
+nums[0] 和 nums[5] 的第 1 位的值为 1 。
+nums[0]、nums[1] 和 nums[5] 的第 2 位的值为 1 。
+nums[1]、nums[2]、nums[3]、nums[4] 和 nums[5] 的第 3 位的值为 1 。
+只有第 0 位和第 3 位满足数组中至少存在 k 个元素在对应位上的值为 1 。因此,答案为 2^0 + 2^3 = 9 。
+
+ +

示例 2:

+ +
+输入:nums = [2,12,1,11,4,5], k = 6
+输出:0
+解释:因为 k == 6 == nums.length ,所以数组的 6-or 等于其中所有元素按位与运算的结果。因此,答案为 2 AND 12 AND 1 AND 11 AND 4 AND 5 = 0 。
+
+ +

示例 3:

+ +
+输入:nums = [10,8,5,9,11,6,8], k = 1
+输出:15
+解释:因为 k == 1 ,数组的 1-or 等于其中所有元素按位或运算的结果。因此,答案为 10 OR 8 OR 5 OR 9 OR 11 OR 6 OR 8 = 15 。
+ +

 

+ +

提示:

+ + + +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2917.Find the K-or of an Array/README_EN.md b/solution/2900-2999/2917.Find the K-or of an Array/README_EN.md new file mode 100644 index 0000000000000..ccfa7d9d79c24 --- /dev/null +++ b/solution/2900-2999/2917.Find the K-or of an Array/README_EN.md @@ -0,0 +1,91 @@ +# [2917. Find the K-or of an Array](https://leetcode.com/problems/find-the-k-or-of-an-array) + +[中文文档](/solution/2900-2999/2917.Find%20the%20K-or%20of%20an%20Array/README.md) + +## Description + +

You are given a 0-indexed integer array nums, and an integer k.

+ +

The K-or of nums is a non-negative integer that satisfies the following:

+ + + +

Return the K-or of nums.

+ +

Note that a bit i is set in x if (2i AND x) == 2i, where AND is the bitwise AND operator.

+ +

 

+

Example 1:

+ +
+Input: nums = [7,12,9,8,9,15], k = 4
+Output: 9
+Explanation: Bit 0 is set at nums[0], nums[2], nums[4], and nums[5].
+Bit 1 is set at nums[0], and nums[5].
+Bit 2 is set at nums[0], nums[1], and nums[5].
+Bit 3 is set at nums[1], nums[2], nums[3], nums[4], and nums[5].
+Only bits 0 and 3 are set in at least k elements of the array, and bits i >= 4 are not set in any of the array's elements. Hence, the answer is 2^0 + 2^3 = 9.
+
+ +

Example 2:

+ +
+Input: nums = [2,12,1,11,4,5], k = 6
+Output: 0
+Explanation: Since k == 6 == nums.length, the 6-or of the array is equal to the bitwise AND of all its elements. Hence, the answer is 2 AND 12 AND 1 AND 11 AND 4 AND 5 = 0.
+
+ +

Example 3:

+ +
+Input: nums = [10,8,5,9,11,6,8], k = 1
+Output: 15
+Explanation: Since k == 1, the 1-or of the array is equal to the bitwise OR of all its elements. Hence, the answer is 10 OR 8 OR 5 OR 9 OR 11 OR 6 OR 8 = 15.
+
+ +

 

+

Constraints:

+ + + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2918.Minimum Equal Sum of Two Arrays After Replacing Zeros/README.md b/solution/2900-2999/2918.Minimum Equal Sum of Two Arrays After Replacing Zeros/README.md new file mode 100644 index 0000000000000..fb70b19b07ac6 --- /dev/null +++ b/solution/2900-2999/2918.Minimum Equal Sum of Two Arrays After Replacing Zeros/README.md @@ -0,0 +1,85 @@ +# [2918. 数组的最小相等和](https://leetcode.cn/problems/minimum-equal-sum-of-two-arrays-after-replacing-zeros) + +[English Version](/solution/2900-2999/2918.Minimum%20Equal%20Sum%20of%20Two%20Arrays%20After%20Replacing%20Zeros/README_EN.md) + +## 题目描述 + + + +

给你两个由正整数和 0 组成的数组 nums1nums2

+ +

你必须将两个数组中的 所有 0 替换为 严格 正整数,并且满足两个数组中所有元素的和 相等

+ +

返回 最小 相等和 ,如果无法使两数组相等,则返回 -1

+ +

 

+ +

示例 1:

+ +
+输入:nums1 = [3,2,0,1,0], nums2 = [6,5,0]
+输出:12
+解释:可以按下述方式替换数组中的 0 :
+- 用 2 和 4 替换 nums1 中的两个 0 。得到 nums1 = [3,2,2,1,4] 。
+- 用 1 替换 nums2 中的一个 0 。得到 nums2 = [6,5,1] 。
+两个数组的元素和相等,都等于 12 。可以证明这是可以获得的最小相等和。
+
+ +

示例 2:

+ +
+输入:nums1 = [2,0,2,0], nums2 = [1,4]
+输出:-1
+解释:无法使两个数组的和相等。
+
+ +

 

+ +

提示:

+ + + +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2918.Minimum Equal Sum of Two Arrays After Replacing Zeros/README_EN.md b/solution/2900-2999/2918.Minimum Equal Sum of Two Arrays After Replacing Zeros/README_EN.md new file mode 100644 index 0000000000000..9d05efb1148f2 --- /dev/null +++ b/solution/2900-2999/2918.Minimum Equal Sum of Two Arrays After Replacing Zeros/README_EN.md @@ -0,0 +1,75 @@ +# [2918. Minimum Equal Sum of Two Arrays After Replacing Zeros](https://leetcode.com/problems/minimum-equal-sum-of-two-arrays-after-replacing-zeros) + +[中文文档](/solution/2900-2999/2918.Minimum%20Equal%20Sum%20of%20Two%20Arrays%20After%20Replacing%20Zeros/README.md) + +## Description + +

You are given two arrays nums1 and nums2 consisting of positive integers.

+ +

You have to replace all the 0's in both arrays with strictly positive integers such that the sum of elements of both arrays becomes equal.

+ +

Return the minimum equal sum you can obtain, or -1 if it is impossible.

+ +

 

+

Example 1:

+ +
+Input: nums1 = [3,2,0,1,0], nums2 = [6,5,0]
+Output: 12
+Explanation: We can replace 0's in the following way:
+- Replace the two 0's in nums1 with the values 2 and 4. The resulting array is nums1 = [3,2,2,1,4].
+- Replace the 0 in nums2 with the value 1. The resulting array is nums2 = [6,5,1].
+Both arrays have an equal sum of 12. It can be shown that it is the minimum sum we can obtain.
+
+ +

Example 2:

+ +
+Input: nums1 = [2,0,2,0], nums2 = [1,4]
+Output: -1
+Explanation: It is impossible to make the sum of both arrays equal.
+
+ +

 

+

Constraints:

+ + + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2919.Minimum Increment Operations to Make Array Beautiful/README.md b/solution/2900-2999/2919.Minimum Increment Operations to Make Array Beautiful/README.md new file mode 100644 index 0000000000000..ec401b101772e --- /dev/null +++ b/solution/2900-2999/2919.Minimum Increment Operations to Make Array Beautiful/README.md @@ -0,0 +1,114 @@ +# [2919. 使数组变美的最小增量运算数](https://leetcode.cn/problems/minimum-increment-operations-to-make-array-beautiful) + +[English Version](/solution/2900-2999/2919.Minimum%20Increment%20Operations%20to%20Make%20Array%20Beautiful/README_EN.md) + +## 题目描述 + + + +

给你一个下标从 0 开始、长度为 n 的整数数组 nums ,和一个整数 k

+ +

你可以执行下述 递增 运算 任意 次(可以是 0 次):

+ + + +

如果数组中任何长度 大于或等于 3 的子数组,其 最大 元素都大于或等于 k ,则认为数组是一个 美丽数组

+ +

以整数形式返回使数组变为 美丽数组 需要执行的 最小 递增运算数。

+ +

子数组是数组中的一个连续 非空 元素序列。

+ +

 

+ +

示例 1:

+ +
+输入:nums = [2,3,0,0,2], k = 4
+输出:3
+解释:可以执行下述递增运算,使 nums 变为美丽数组:
+选择下标 i = 1 ,并且将 nums[1] 的值加 1 -> [2,4,0,0,2] 。
+选择下标 i = 4 ,并且将 nums[4] 的值加 1 -> [2,4,0,0,3] 。
+选择下标 i = 4 ,并且将 nums[4] 的值加 1 -> [2,4,0,0,4] 。
+长度大于或等于 3 的子数组为 [2,4,0], [4,0,0], [0,0,4], [2,4,0,0], [4,0,0,4], [2,4,0,0,4] 。
+在所有子数组中,最大元素都等于 k = 4 ,所以 nums 现在是美丽数组。
+可以证明无法用少于 3 次递增运算使 nums 变为美丽数组。
+因此,答案为 3 。
+
+ +

示例 2:

+ +
+输入:nums = [0,1,3,3], k = 5
+输出:2
+解释:可以执行下述递增运算,使 nums 变为美丽数组:
+选择下标 i = 2 ,并且将 nums[2] 的值加 1 -> [0,1,4,3] 。
+选择下标 i = 2 ,并且将 nums[2] 的值加 1 -> [0,1,5,3] 。
+长度大于或等于 3 的子数组为 [0,1,5]、[1,5,3]、[0,1,5,3] 。
+在所有子数组中,最大元素都等于 k = 5 ,所以 nums 现在是美丽数组。
+可以证明无法用少于 2 次递增运算使 nums 变为美丽数组。 
+因此,答案为 2 。
+
+ +

示例 3:

+ +
+输入:nums = [1,1,2], k = 1
+输出:0
+解释:在这个示例中,只有一个长度大于或等于 3 的子数组 [1,1,2] 。
+其最大元素 2 已经大于 k = 1 ,所以无需执行任何增量运算。
+因此,答案为 0 。
+
+ +

 

+ +

提示:

+ + + +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2919.Minimum Increment Operations to Make Array Beautiful/README_EN.md b/solution/2900-2999/2919.Minimum Increment Operations to Make Array Beautiful/README_EN.md new file mode 100644 index 0000000000000..d3820c07ecaaa --- /dev/null +++ b/solution/2900-2999/2919.Minimum Increment Operations to Make Array Beautiful/README_EN.md @@ -0,0 +1,104 @@ +# [2919. Minimum Increment Operations to Make Array Beautiful](https://leetcode.com/problems/minimum-increment-operations-to-make-array-beautiful) + +[中文文档](/solution/2900-2999/2919.Minimum%20Increment%20Operations%20to%20Make%20Array%20Beautiful/README.md) + +## Description + +

You are given a 0-indexed integer array nums having length n, and an integer k.

+ +

You can perform the following increment operation any number of times (including zero):

+ + + +

An array is considered beautiful if, for any subarray with a size of 3 or more, its maximum element is greater than or equal to k.

+ +

Return an integer denoting the minimum number of increment operations needed to make nums beautiful.

+ +

A subarray is a contiguous non-empty sequence of elements within an array.

+ +

 

+

Example 1:

+ +
+Input: nums = [2,3,0,0,2], k = 4
+Output: 3
+Explanation: We can perform the following increment operations to make nums beautiful:
+Choose index i = 1 and increase nums[1] by 1 -> [2,4,0,0,2].
+Choose index i = 4 and increase nums[4] by 1 -> [2,4,0,0,3].
+Choose index i = 4 and increase nums[4] by 1 -> [2,4,0,0,4].
+The subarrays with a size of 3 or more are: [2,4,0], [4,0,0], [0,0,4], [2,4,0,0], [4,0,0,4], [2,4,0,0,4].
+In all the subarrays, the maximum element is equal to k = 4, so nums is now beautiful.
+It can be shown that nums cannot be made beautiful with fewer than 3 increment operations.
+Hence, the answer is 3.
+
+ +

Example 2:

+ +
+Input: nums = [0,1,3,3], k = 5
+Output: 2
+Explanation: We can perform the following increment operations to make nums beautiful:
+Choose index i = 2 and increase nums[2] by 1 -> [0,1,4,3].
+Choose index i = 2 and increase nums[2] by 1 -> [0,1,5,3].
+The subarrays with a size of 3 or more are: [0,1,5], [1,5,3], [0,1,5,3].
+In all the subarrays, the maximum element is equal to k = 5, so nums is now beautiful.
+It can be shown that nums cannot be made beautiful with fewer than 2 increment operations.
+Hence, the answer is 2.
+
+ +

Example 3:

+ +
+Input: nums = [1,1,2], k = 1
+Output: 0
+Explanation: The only subarray with a size of 3 or more in this example is [1,1,2].
+The maximum element, 2, is already greater than k = 1, so we don't need any increment operation.
+Hence, the answer is 0.
+
+ +

 

+

Constraints:

+ + + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/README.md b/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/README.md new file mode 100644 index 0000000000000..5a8d0001de7c9 --- /dev/null +++ b/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/README.md @@ -0,0 +1,100 @@ +# [2920. 收集所有金币可获得的最大积分](https://leetcode.cn/problems/maximum-points-after-collecting-coins-from-all-nodes) + +[English Version](/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/README_EN.md) + +## 题目描述 + + + +

节点 0 处现有一棵由 n 个节点组成的无向树,节点编号从 0n - 1 。给你一个长度为 n - 1 的二维 整数 数组 edges ,其中 edges[i] = [ai, bi] 表示在树上的节点 aibi 之间存在一条边。另给你一个下标从 0 开始、长度为 n 的数组 coins 和一个整数 k ,其中 coins[i] 表示节点 i 处的金币数量。

+ +

从根节点开始,你必须收集所有金币。要想收集节点上的金币,必须先收集该节点的祖先节点上的金币。

+ +

节点 i 上的金币可以用下述方法之一进行收集:

+ + + +

返回收集 所有 树节点的金币之后可以获得的最大积分。

+ +

 

+ +

示例 1:

+ +
+输入:edges = [[0,1],[1,2],[2,3]], coins = [10,10,3,3], k = 5
+输出:11                        
+解释:
+使用第一种方法收集节点 0 上的所有金币。总积分 = 10 - 5 = 5 。
+使用第一种方法收集节点 1 上的所有金币。总积分 = 5 + (10 - 5) = 10 。
+使用第二种方法收集节点 2 上的所有金币。所以节点 3 上的金币将会变为 floor(3 / 2) = 1 ,总积分 = 10 + floor(3 / 2) = 11 。
+使用第二种方法收集节点 3 上的所有金币。总积分 =  11 + floor(1 / 2) = 11.
+可以证明收集所有节点上的金币能获得的最大积分是 11 。 
+
+ +

示例 2:

+ + +
+输入:edges = [[0,1],[0,2]], coins = [8,4,4], k = 0
+输出:16
+解释:
+使用第一种方法收集所有节点上的金币,因此,总积分 = (8 - 0) + (4 - 0) + (4 - 0) = 16 。
+
+ +

 

+ +

提示:

+ + + +## 解法 + + + + + +### **Python3** + + + +```python + +``` + +### **Java** + + + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/README_EN.md b/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/README_EN.md new file mode 100644 index 0000000000000..37ed176f0f042 --- /dev/null +++ b/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/README_EN.md @@ -0,0 +1,90 @@ +# [2920. Maximum Points After Collecting Coins From All Nodes](https://leetcode.com/problems/maximum-points-after-collecting-coins-from-all-nodes) + +[中文文档](/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/README.md) + +## Description + +

There exists an undirected tree rooted at node 0 with n nodes labeled from 0 to n - 1. You are given a 2D integer array edges of length n - 1, where edges[i] = [ai, bi] indicates that there is an edge between nodes ai and bi in the tree. You are also given a 0-indexed array coins of size n where coins[i] indicates the number of coins in the vertex i, and an integer k.

+ +

Starting from the root, you have to collect all the coins such that the coins at a node can only be collected if the coins of its ancestors have been already collected.

+ +

Coins at nodei can be collected in one of the following ways:

+ + + +

Return the maximum points you can get after collecting the coins from all the tree nodes.

+ +

 

+

Example 1:

+ +
+Input: edges = [[0,1],[1,2],[2,3]], coins = [10,10,3,3], k = 5
+Output: 11                        
+Explanation: 
+Collect all the coins from node 0 using the first way. Total points = 10 - 5 = 5.
+Collect all the coins from node 1 using the first way. Total points = 5 + (10 - 5) = 10.
+Collect all the coins from node 2 using the second way so coins left at node 3 will be floor(3 / 2) = 1. Total points = 10 + floor(3 / 2) = 11.
+Collect all the coins from node 3 using the second way. Total points = 11 + floor(1 / 2) = 11.
+It can be shown that the maximum points we can get after collecting coins from all the nodes is 11. 
+
+ +

Example 2:

+ + +
+Input: edges = [[0,1],[0,2]], coins = [8,4,4], k = 0
+Output: 16
+Explanation: 
+Coins will be collected from all the nodes using the first way. Therefore, total points = (8 - 0) + (4 - 0) + (4 - 0) = 16.
+
+ +

 

+

Constraints:

+ + + +## Solutions + + + +### **Python3** + +```python + +``` + +### **Java** + +```java + +``` + +### **C++** + +```cpp + +``` + +### **Go** + +```go + +``` + +### **...** + +``` + +``` + + diff --git a/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/images/ex1-copy.png b/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/images/ex1-copy.png new file mode 100644 index 0000000000000..da340d84e2222 Binary files /dev/null and b/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/images/ex1-copy.png differ diff --git a/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/images/ex2.png b/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/images/ex2.png new file mode 100644 index 0000000000000..b2f9218fffa53 Binary files /dev/null and b/solution/2900-2999/2920.Maximum Points After Collecting Coins From All Nodes/images/ex2.png differ diff --git a/solution/CONTEST_README.md b/solution/CONTEST_README.md index 992d7230dd9a0..1e35f12bb5c89 100644 --- a/solution/CONTEST_README.md +++ b/solution/CONTEST_README.md @@ -22,6 +22,20 @@ ## 往期竞赛 +#### 第 369 场周赛(2023-10-29 10:30, 90 分钟) 参赛人数 4121 + +- [2917. 找出数组中的 K-or 值](/solution/2900-2999/2917.Find%20the%20K-or%20of%20an%20Array/README.md) +- [2918. 数组的最小相等和](/solution/2900-2999/2918.Minimum%20Equal%20Sum%20of%20Two%20Arrays%20After%20Replacing%20Zeros/README.md) +- [2919. 使数组变美的最小增量运算数](/solution/2900-2999/2919.Minimum%20Increment%20Operations%20to%20Make%20Array%20Beautiful/README.md) +- [2920. 收集所有金币可获得的最大积分](/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/README.md) + +#### 第 116 场双周赛(2023-10-28 22:30, 90 分钟) 参赛人数 2904 + +- [2913. 子数组不同元素数目的平方和 I](/solution/2900-2999/2913.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20I/README.md) +- [2914. 使二进制字符串变美丽的最少修改次数](/solution/2900-2999/2914.Minimum%20Number%20of%20Changes%20to%20Make%20Binary%20String%20Beautiful/README.md) +- [2915. 和为目标值的最长子序列的长度](/solution/2900-2999/2915.Length%20of%20the%20Longest%20Subsequence%20That%20Sums%20to%20Target/README.md) +- [2916. 子数组不同元素数目的平方和 II](/solution/2900-2999/2916.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20II/README.md) + #### 第 368 场周赛(2023-10-22 10:30, 90 分钟) 参赛人数 5002 - [2908. 元素和最小的山形三元组 I](/solution/2900-2999/2908.Minimum%20Sum%20of%20Mountain%20Triplets%20I/README.md) diff --git a/solution/CONTEST_README_EN.md b/solution/CONTEST_README_EN.md index 6274df1765a81..4eba855bbc6b9 100644 --- a/solution/CONTEST_README_EN.md +++ b/solution/CONTEST_README_EN.md @@ -25,6 +25,20 @@ Get your rating changes right after the completion of LeetCode contests, https:/ ## Past Contests +#### Weekly Contest 369 + +- [2917. Find the K-or of an Array](/solution/2900-2999/2917.Find%20the%20K-or%20of%20an%20Array/README_EN.md) +- [2918. Minimum Equal Sum of Two Arrays After Replacing Zeros](/solution/2900-2999/2918.Minimum%20Equal%20Sum%20of%20Two%20Arrays%20After%20Replacing%20Zeros/README_EN.md) +- [2919. Minimum Increment Operations to Make Array Beautiful](/solution/2900-2999/2919.Minimum%20Increment%20Operations%20to%20Make%20Array%20Beautiful/README_EN.md) +- [2920. Maximum Points After Collecting Coins From All Nodes](/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/README_EN.md) + +#### Biweekly Contest 116 + +- [2913. Subarrays Distinct Element Sum of Squares I](/solution/2900-2999/2913.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20I/README_EN.md) +- [2914. Minimum Number of Changes to Make Binary String Beautiful](/solution/2900-2999/2914.Minimum%20Number%20of%20Changes%20to%20Make%20Binary%20String%20Beautiful/README_EN.md) +- [2915. Length of the Longest Subsequence That Sums to Target](/solution/2900-2999/2915.Length%20of%20the%20Longest%20Subsequence%20That%20Sums%20to%20Target/README_EN.md) +- [2916. Subarrays Distinct Element Sum of Squares II](/solution/2900-2999/2916.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20II/README_EN.md) + #### Weekly Contest 368 - [2908. Minimum Sum of Mountain Triplets I](/solution/2900-2999/2908.Minimum%20Sum%20of%20Mountain%20Triplets%20I/README_EN.md) diff --git a/solution/README.md b/solution/README.md index dabb27a2dfecc..e79a603e62519 100644 --- a/solution/README.md +++ b/solution/README.md @@ -2923,6 +2923,14 @@ | 2910 | [合法分组的最少组数](/solution/2900-2999/2910.Minimum%20Number%20of%20Groups%20to%20Create%20a%20Valid%20Assignment/README.md) | `贪心`,`数组`,`哈希表` | 中等 | 第 368 场周赛 | | 2911 | [得到 K 个半回文串的最少修改次数](/solution/2900-2999/2911.Minimum%20Changes%20to%20Make%20K%20Semi-palindromes/README.md) | `双指针`,`字符串`,`动态规划` | 困难 | 第 368 场周赛 | | 2912 | [在网格上移动到目的地的方法数](/solution/2900-2999/2912.Number%20of%20Ways%20to%20Reach%20Destination%20in%20the%20Grid/README.md) | | 困难 | 🔒 | +| 2913 | [子数组不同元素数目的平方和 I](/solution/2900-2999/2913.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20I/README.md) | | 简单 | 第 116 场双周赛 | +| 2914 | [使二进制字符串变美丽的最少修改次数](/solution/2900-2999/2914.Minimum%20Number%20of%20Changes%20to%20Make%20Binary%20String%20Beautiful/README.md) | | 中等 | 第 116 场双周赛 | +| 2915 | [和为目标值的最长子序列的长度](/solution/2900-2999/2915.Length%20of%20the%20Longest%20Subsequence%20That%20Sums%20to%20Target/README.md) | | 中等 | 第 116 场双周赛 | +| 2916 | [子数组不同元素数目的平方和 II](/solution/2900-2999/2916.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20II/README.md) | | 困难 | 第 116 场双周赛 | +| 2917 | [找出数组中的 K-or 值](/solution/2900-2999/2917.Find%20the%20K-or%20of%20an%20Array/README.md) | | 简单 | 第 369 场周赛 | +| 2918 | [数组的最小相等和](/solution/2900-2999/2918.Minimum%20Equal%20Sum%20of%20Two%20Arrays%20After%20Replacing%20Zeros/README.md) | | 中等 | 第 369 场周赛 | +| 2919 | [使数组变美的最小增量运算数](/solution/2900-2999/2919.Minimum%20Increment%20Operations%20to%20Make%20Array%20Beautiful/README.md) | | 中等 | 第 369 场周赛 | +| 2920 | [收集所有金币可获得的最大积分](/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/README.md) | | 困难 | 第 369 场周赛 | ## 版权 diff --git a/solution/README_EN.md b/solution/README_EN.md index 28238034c5418..3f01369883802 100644 --- a/solution/README_EN.md +++ b/solution/README_EN.md @@ -2921,6 +2921,14 @@ Press Control + F(or Command + F on | 2910 | [Minimum Number of Groups to Create a Valid Assignment](/solution/2900-2999/2910.Minimum%20Number%20of%20Groups%20to%20Create%20a%20Valid%20Assignment/README_EN.md) | `Greedy`,`Array`,`Hash Table` | Medium | Weekly Contest 368 | | 2911 | [Minimum Changes to Make K Semi-palindromes](/solution/2900-2999/2911.Minimum%20Changes%20to%20Make%20K%20Semi-palindromes/README_EN.md) | `Two Pointers`,`String`,`Dynamic Programming` | Hard | Weekly Contest 368 | | 2912 | [Number of Ways to Reach Destination in the Grid](/solution/2900-2999/2912.Number%20of%20Ways%20to%20Reach%20Destination%20in%20the%20Grid/README_EN.md) | | Hard | 🔒 | +| 2913 | [Subarrays Distinct Element Sum of Squares I](/solution/2900-2999/2913.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20I/README_EN.md) | | Easy | Biweekly Contest 116 | +| 2914 | [Minimum Number of Changes to Make Binary String Beautiful](/solution/2900-2999/2914.Minimum%20Number%20of%20Changes%20to%20Make%20Binary%20String%20Beautiful/README_EN.md) | | Medium | Biweekly Contest 116 | +| 2915 | [Length of the Longest Subsequence That Sums to Target](/solution/2900-2999/2915.Length%20of%20the%20Longest%20Subsequence%20That%20Sums%20to%20Target/README_EN.md) | | Medium | Biweekly Contest 116 | +| 2916 | [Subarrays Distinct Element Sum of Squares II](/solution/2900-2999/2916.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20II/README_EN.md) | | Hard | Biweekly Contest 116 | +| 2917 | [Find the K-or of an Array](/solution/2900-2999/2917.Find%20the%20K-or%20of%20an%20Array/README_EN.md) | | Easy | Weekly Contest 369 | +| 2918 | [Minimum Equal Sum of Two Arrays After Replacing Zeros](/solution/2900-2999/2918.Minimum%20Equal%20Sum%20of%20Two%20Arrays%20After%20Replacing%20Zeros/README_EN.md) | | Medium | Weekly Contest 369 | +| 2919 | [Minimum Increment Operations to Make Array Beautiful](/solution/2900-2999/2919.Minimum%20Increment%20Operations%20to%20Make%20Array%20Beautiful/README_EN.md) | | Medium | Weekly Contest 369 | +| 2920 | [Maximum Points After Collecting Coins From All Nodes](/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/README_EN.md) | | Hard | Weekly Contest 369 | ## Copyright diff --git a/solution/summary.md b/solution/summary.md index 6c530673acf71..104a5e9ad401c 100644 --- a/solution/summary.md +++ b/solution/summary.md @@ -2970,3 +2970,11 @@ - [2910.合法分组的最少组数](/solution/2900-2999/2910.Minimum%20Number%20of%20Groups%20to%20Create%20a%20Valid%20Assignment/README.md) - [2911.得到 K 个半回文串的最少修改次数](/solution/2900-2999/2911.Minimum%20Changes%20to%20Make%20K%20Semi-palindromes/README.md) - [2912.在网格上移动到目的地的方法数](/solution/2900-2999/2912.Number%20of%20Ways%20to%20Reach%20Destination%20in%20the%20Grid/README.md) + - [2913.子数组不同元素数目的平方和 I](/solution/2900-2999/2913.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20I/README.md) + - [2914.使二进制字符串变美丽的最少修改次数](/solution/2900-2999/2914.Minimum%20Number%20of%20Changes%20to%20Make%20Binary%20String%20Beautiful/README.md) + - [2915.和为目标值的最长子序列的长度](/solution/2900-2999/2915.Length%20of%20the%20Longest%20Subsequence%20That%20Sums%20to%20Target/README.md) + - [2916.子数组不同元素数目的平方和 II](/solution/2900-2999/2916.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20II/README.md) + - [2917.找出数组中的 K-or 值](/solution/2900-2999/2917.Find%20the%20K-or%20of%20an%20Array/README.md) + - [2918.数组的最小相等和](/solution/2900-2999/2918.Minimum%20Equal%20Sum%20of%20Two%20Arrays%20After%20Replacing%20Zeros/README.md) + - [2919.使数组变美的最小增量运算数](/solution/2900-2999/2919.Minimum%20Increment%20Operations%20to%20Make%20Array%20Beautiful/README.md) + - [2920.收集所有金币可获得的最大积分](/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/README.md) diff --git a/solution/summary_en.md b/solution/summary_en.md index c86edb99ce777..ebdf1445df18f 100644 --- a/solution/summary_en.md +++ b/solution/summary_en.md @@ -2970,3 +2970,11 @@ - [2910.Minimum Number of Groups to Create a Valid Assignment](/solution/2900-2999/2910.Minimum%20Number%20of%20Groups%20to%20Create%20a%20Valid%20Assignment/README_EN.md) - [2911.Minimum Changes to Make K Semi-palindromes](/solution/2900-2999/2911.Minimum%20Changes%20to%20Make%20K%20Semi-palindromes/README_EN.md) - [2912.Number of Ways to Reach Destination in the Grid](/solution/2900-2999/2912.Number%20of%20Ways%20to%20Reach%20Destination%20in%20the%20Grid/README_EN.md) + - [2913.Subarrays Distinct Element Sum of Squares I](/solution/2900-2999/2913.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20I/README_EN.md) + - [2914.Minimum Number of Changes to Make Binary String Beautiful](/solution/2900-2999/2914.Minimum%20Number%20of%20Changes%20to%20Make%20Binary%20String%20Beautiful/README_EN.md) + - [2915.Length of the Longest Subsequence That Sums to Target](/solution/2900-2999/2915.Length%20of%20the%20Longest%20Subsequence%20That%20Sums%20to%20Target/README_EN.md) + - [2916.Subarrays Distinct Element Sum of Squares II](/solution/2900-2999/2916.Subarrays%20Distinct%20Element%20Sum%20of%20Squares%20II/README_EN.md) + - [2917.Find the K-or of an Array](/solution/2900-2999/2917.Find%20the%20K-or%20of%20an%20Array/README_EN.md) + - [2918.Minimum Equal Sum of Two Arrays After Replacing Zeros](/solution/2900-2999/2918.Minimum%20Equal%20Sum%20of%20Two%20Arrays%20After%20Replacing%20Zeros/README_EN.md) + - [2919.Minimum Increment Operations to Make Array Beautiful](/solution/2900-2999/2919.Minimum%20Increment%20Operations%20to%20Make%20Array%20Beautiful/README_EN.md) + - [2920.Maximum Points After Collecting Coins From All Nodes](/solution/2900-2999/2920.Maximum%20Points%20After%20Collecting%20Coins%20From%20All%20Nodes/README_EN.md)