diff --git a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/README.md b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/README.md index b3bb27d7e347a..b5117b1c733f8 100644 --- a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/README.md +++ b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/README.md @@ -71,9 +71,9 @@ nums 的数字和是 1 + 2 + 3 + 4 = 10 。 ### 方法一:模拟 -我们遍历数组 $nums$,计算元素和 $a$ 与数字和 $b$,最后返回 $|a - b|$ 即可。 +我们遍历数组 $\textit{nums}$,计算元素和 $x$ 和数字和 $y$,最后返回 $|x - y|$ 即可。由于 $x$ 一定大于等于 $y$,所以我们也可以直接返回 $x - y$。 -时间复杂度 $O(n)$,其中 $n$ 为数组 $nums$ 的长度。空间复杂度 $O(1)$。 +时间复杂度 $O(n \times \log_{10} M)$,其中 $n$ 和 $M$ 分别是数组 $\textit{nums}$ 的长度和数组中元素的最大值。空间复杂度 $O(1)$。 @@ -82,12 +82,13 @@ nums 的数字和是 1 + 2 + 3 + 4 = 10 。 ```python class Solution: def differenceOfSum(self, nums: List[int]) -> int: - a, b = sum(nums), 0 - for x in nums: - while x: - b += x % 10 - x //= 10 - return abs(a - b) + x = y = 0 + for v in nums: + x += v + while v: + y += v % 10 + v //= 10 + return x - y ``` #### Java @@ -95,14 +96,14 @@ class Solution: ```java class Solution { public int differenceOfSum(int[] nums) { - int a = 0, b = 0; - for (int x : nums) { - a += x; - for (; x > 0; x /= 10) { - b += x % 10; + int x = 0, y = 0; + for (int v : nums) { + x += v; + for (; v > 0; v /= 10) { + y += v % 10; } } - return Math.abs(a - b); + return x - y; } } ``` @@ -113,14 +114,14 @@ class Solution { class Solution { public: int differenceOfSum(vector& nums) { - int a = 0, b = 0; - for (int x : nums) { - a += x; - for (; x; x /= 10) { - b += x % 10; + int x = 0, y = 0; + for (int v : nums) { + x += v; + for (; v; v /= 10) { + y += v % 10; } } - return abs(a - b); + return x - y; } }; ``` @@ -129,21 +130,14 @@ public: ```go func differenceOfSum(nums []int) int { - a, b := 0, 0 - for _, x := range nums { - a += x - for ; x > 0; x /= 10 { - b += x % 10 + var x, y int + for _, v := range nums { + x += v + for ; v > 0; v /= 10 { + y += v % 10 } } - return abs(a - b) -} - -func abs(x int) int { - if x < 0 { - return -x - } - return x + return x - y } ``` @@ -151,14 +145,14 @@ func abs(x int) int { ```ts function differenceOfSum(nums: number[]): number { - return nums.reduce((r, v) => { - r += v; - while (v !== 0) { - r -= v % 10; - v = Math.floor(v / 10); + let [x, y] = [0, 0]; + for (let v of nums) { + x += v; + for (; v; v = Math.floor(v / 10)) { + y += v % 10; } - return r; - }, 0); + } + return x - y; } ``` @@ -167,16 +161,19 @@ function differenceOfSum(nums: number[]): number { ```rust impl Solution { pub fn difference_of_sum(nums: Vec) -> i32 { - let mut ans = 0; - for &num in nums.iter() { - let mut num = num; - ans += num; - while num != 0 { - ans -= num % 10; + let mut x = 0; + let mut y = 0; + + for &v in &nums { + x += v; + let mut num = v; + while num > 0 { + y += num % 10; num /= 10; } } - ans + + x - y } } ``` @@ -185,45 +182,16 @@ impl Solution { ```c int differenceOfSum(int* nums, int numsSize) { - int ans = 0; + int x = 0, y = 0; for (int i = 0; i < numsSize; i++) { - ans += nums[i]; - while (nums[i]) { - ans -= nums[i] % 10; - nums[i] /= 10; + int v = nums[i]; + x += v; + while (v > 0) { + y += v % 10; + v /= 10; } } - return ans; -} -``` - - - - - - - -### 方法二 - - - -#### Rust - -```rust -impl Solution { - pub fn difference_of_sum(nums: Vec) -> i32 { - let a: i32 = nums.iter().sum(); - let b: i32 = nums - .iter() - .map(|&n| { - n.to_string() - .chars() - .map(|c| c.to_digit(10).unwrap() as i32) - .sum::() - }) - .sum(); - (a - b).abs() - } + return x - y; } ``` diff --git a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/README_EN.md b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/README_EN.md index d31b871ccee90..6f3720b561ecd 100644 --- a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/README_EN.md +++ b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/README_EN.md @@ -36,7 +36,7 @@ tags:
 Input: nums = [1,15,6,3]
 Output: 9
-Explanation: 
+Explanation:
 The element sum of nums is 1 + 15 + 6 + 3 = 25.
 The digit sum of nums is 1 + 1 + 5 + 6 + 3 = 16.
 The absolute difference between the element sum and digit sum is |25 - 16| = 9.
@@ -67,11 +67,10 @@ The absolute difference between the element sum and digit sum is |10 - 10| = 0.
 
 
 
-### Solution 1: Simulation
-
-We traverse the array $nums$, calculate the sum of elements $a$ and the sum of digits $b$, and finally return $|a - b|$.
+Solution 1: Simulation
+We traverse the array $\textit{nums}$, calculate the sum of the elements $x$ and the sum of the digits $y$, and finally return $|x - y|$. Since $x$ is always greater than or equal to $y$, we can directly return $x - y$.
 
-The time complexity is $O(n)$, where $n$ is the length of the array $nums$. The space complexity is $O(1)$.
+The time complexity is $O(n \times \log_{10} M)$, where $n$ and $M$ are the length of the array $\textit{nums}$ and the maximum value of the elements in the array, respectively. The space complexity is $O(1)$.
 
 
 
@@ -80,12 +79,13 @@ The time complexity is $O(n)$, where $n$ is the length of the array $nums$. The
 ```python
 class Solution:
     def differenceOfSum(self, nums: List[int]) -> int:
-        a, b = sum(nums), 0
-        for x in nums:
-            while x:
-                b += x % 10
-                x //= 10
-        return abs(a - b)
+        x = y = 0
+        for v in nums:
+            x += v
+            while v:
+                y += v % 10
+                v //= 10
+        return x - y
 ```
 
 #### Java
@@ -93,14 +93,14 @@ class Solution:
 ```java
 class Solution {
     public int differenceOfSum(int[] nums) {
-        int a = 0, b = 0;
-        for (int x : nums) {
-            a += x;
-            for (; x > 0; x /= 10) {
-                b += x % 10;
+        int x = 0, y = 0;
+        for (int v : nums) {
+            x += v;
+            for (; v > 0; v /= 10) {
+                y += v % 10;
             }
         }
-        return Math.abs(a - b);
+        return x - y;
     }
 }
 ```
@@ -111,14 +111,14 @@ class Solution {
 class Solution {
 public:
     int differenceOfSum(vector& nums) {
-        int a = 0, b = 0;
-        for (int x : nums) {
-            a += x;
-            for (; x; x /= 10) {
-                b += x % 10;
+        int x = 0, y = 0;
+        for (int v : nums) {
+            x += v;
+            for (; v; v /= 10) {
+                y += v % 10;
             }
         }
-        return abs(a - b);
+        return x - y;
     }
 };
 ```
@@ -127,21 +127,14 @@ public:
 
 ```go
 func differenceOfSum(nums []int) int {
-	a, b := 0, 0
-	for _, x := range nums {
-		a += x
-		for ; x > 0; x /= 10 {
-			b += x % 10
+	var x, y int
+	for _, v := range nums {
+		x += v
+		for ; v > 0; v /= 10 {
+			y += v % 10
 		}
 	}
-	return abs(a - b)
-}
-
-func abs(x int) int {
-	if x < 0 {
-		return -x
-	}
-	return x
+	return x - y
 }
 ```
 
@@ -149,14 +142,14 @@ func abs(x int) int {
 
 ```ts
 function differenceOfSum(nums: number[]): number {
-    return nums.reduce((r, v) => {
-        r += v;
-        while (v !== 0) {
-            r -= v % 10;
-            v = Math.floor(v / 10);
+    let [x, y] = [0, 0];
+    for (let v of nums) {
+        x += v;
+        for (; v; v = Math.floor(v / 10)) {
+            y += v % 10;
         }
-        return r;
-    }, 0);
+    }
+    return x - y;
 }
 ```
 
@@ -165,16 +158,19 @@ function differenceOfSum(nums: number[]): number {
 ```rust
 impl Solution {
     pub fn difference_of_sum(nums: Vec) -> i32 {
-        let mut ans = 0;
-        for &num in nums.iter() {
-            let mut num = num;
-            ans += num;
-            while num != 0 {
-                ans -= num % 10;
+        let mut x = 0;
+        let mut y = 0;
+
+        for &v in &nums {
+            x += v;
+            let mut num = v;
+            while num > 0 {
+                y += num % 10;
                 num /= 10;
             }
         }
-        ans
+
+        x - y
     }
 }
 ```
@@ -183,45 +179,16 @@ impl Solution {
 
 ```c
 int differenceOfSum(int* nums, int numsSize) {
-    int ans = 0;
+    int x = 0, y = 0;
     for (int i = 0; i < numsSize; i++) {
-        ans += nums[i];
-        while (nums[i]) {
-            ans -= nums[i] % 10;
-            nums[i] /= 10;
+        int v = nums[i];
+        x += v;
+        while (v > 0) {
+            y += v % 10;
+            v /= 10;
         }
     }
-    return ans;
-}
-```
-
-
-
-
-
-
-
-### Solution 2
-
-
-
-#### Rust
-
-```rust
-impl Solution {
-    pub fn difference_of_sum(nums: Vec) -> i32 {
-        let a: i32 = nums.iter().sum();
-        let b: i32 = nums
-            .iter()
-            .map(|&n| {
-                n.to_string()
-                    .chars()
-                    .map(|c| c.to_digit(10).unwrap() as i32)
-                    .sum::()
-            })
-            .sum();
-        (a - b).abs()
-    }
+    return x - y;
 }
 ```
 
diff --git a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.c b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.c
index 9048644a6884e..082f60821cc69 100644
--- a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.c	
+++ b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.c	
@@ -1,11 +1,12 @@
 int differenceOfSum(int* nums, int numsSize) {
-    int ans = 0;
+    int x = 0, y = 0;
     for (int i = 0; i < numsSize; i++) {
-        ans += nums[i];
-        while (nums[i]) {
-            ans -= nums[i] % 10;
-            nums[i] /= 10;
+        int v = nums[i];
+        x += v;
+        while (v > 0) {
+            y += v % 10;
+            v /= 10;
         }
     }
-    return ans;
-}
\ No newline at end of file
+    return x - y;
+}
diff --git a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.cpp b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.cpp
index a89eb67726c8f..2734cbefa0e68 100644
--- a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.cpp	
+++ b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.cpp	
@@ -1,13 +1,13 @@
 class Solution {
 public:
     int differenceOfSum(vector& nums) {
-        int a = 0, b = 0;
-        for (int x : nums) {
-            a += x;
-            for (; x; x /= 10) {
-                b += x % 10;
+        int x = 0, y = 0;
+        for (int v : nums) {
+            x += v;
+            for (; v; v /= 10) {
+                y += v % 10;
             }
         }
-        return abs(a - b);
+        return x - y;
     }
-};
\ No newline at end of file
+};
diff --git a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.go b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.go
index 90a6070afe64e..aca9ff8f98f38 100644
--- a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.go	
+++ b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.go	
@@ -1,17 +1,10 @@
 func differenceOfSum(nums []int) int {
-	a, b := 0, 0
-	for _, x := range nums {
-		a += x
-		for ; x > 0; x /= 10 {
-			b += x % 10
+	var x, y int
+	for _, v := range nums {
+		x += v
+		for ; v > 0; v /= 10 {
+			y += v % 10
 		}
 	}
-	return abs(a - b)
+	return x - y
 }
-
-func abs(x int) int {
-	if x < 0 {
-		return -x
-	}
-	return x
-}
\ No newline at end of file
diff --git a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.java b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.java
index 8ed05c933f1f8..1cb378b55e01c 100644
--- a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.java	
+++ b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.java	
@@ -1,12 +1,12 @@
 class Solution {
     public int differenceOfSum(int[] nums) {
-        int a = 0, b = 0;
-        for (int x : nums) {
-            a += x;
-            for (; x > 0; x /= 10) {
-                b += x % 10;
+        int x = 0, y = 0;
+        for (int v : nums) {
+            x += v;
+            for (; v > 0; v /= 10) {
+                y += v % 10;
             }
         }
-        return Math.abs(a - b);
+        return x - y;
     }
-}
\ No newline at end of file
+}
diff --git a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.py b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.py
index 7cb385a68fb56..ced75e209e93b 100644
--- a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.py	
+++ b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.py	
@@ -1,8 +1,9 @@
 class Solution:
     def differenceOfSum(self, nums: List[int]) -> int:
-        a, b = sum(nums), 0
-        for x in nums:
-            while x:
-                b += x % 10
-                x //= 10
-        return abs(a - b)
+        x = y = 0
+        for v in nums:
+            x += v
+            while v:
+                y += v % 10
+                v //= 10
+        return x - y
diff --git a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.rs b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.rs
index 7b265d4053c2e..f0b7e1122eaf3 100644
--- a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.rs	
+++ b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.rs	
@@ -1,14 +1,17 @@
 impl Solution {
     pub fn difference_of_sum(nums: Vec) -> i32 {
-        let mut ans = 0;
-        for &num in nums.iter() {
-            let mut num = num;
-            ans += num;
-            while num != 0 {
-                ans -= num % 10;
+        let mut x = 0;
+        let mut y = 0;
+
+        for &v in &nums {
+            x += v;
+            let mut num = v;
+            while num > 0 {
+                y += num % 10;
                 num /= 10;
             }
         }
-        ans
+
+        x - y
     }
 }
diff --git a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.ts b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.ts
index 66e8d260d6919..035fd9bbe9267 100644
--- a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.ts	
+++ b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution.ts	
@@ -1,10 +1,10 @@
 function differenceOfSum(nums: number[]): number {
-    return nums.reduce((r, v) => {
-        r += v;
-        while (v !== 0) {
-            r -= v % 10;
-            v = Math.floor(v / 10);
+    let [x, y] = [0, 0];
+    for (let v of nums) {
+        x += v;
+        for (; v; v = Math.floor(v / 10)) {
+            y += v % 10;
         }
-        return r;
-    }, 0);
+    }
+    return x - y;
 }
diff --git a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution2.rs b/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution2.rs
deleted file mode 100644
index b8e10bd1a5aea..0000000000000
--- a/solution/2500-2599/2535.Difference Between Element Sum and Digit Sum of an Array/Solution2.rs	
+++ /dev/null
@@ -1,15 +0,0 @@
-impl Solution {
-    pub fn difference_of_sum(nums: Vec) -> i32 {
-        let a: i32 = nums.iter().sum();
-        let b: i32 = nums
-            .iter()
-            .map(|&n| {
-                n.to_string()
-                    .chars()
-                    .map(|c| c.to_digit(10).unwrap() as i32)
-                    .sum::()
-            })
-            .sum();
-        (a - b).abs()
-    }
-}
diff --git a/solution/3200-3299/3299.Sum of Consecutive Subsequences/README.md b/solution/3200-3299/3299.Sum of Consecutive Subsequences/README.md
new file mode 100644
index 0000000000000..4a00a781cb041
--- /dev/null
+++ b/solution/3200-3299/3299.Sum of Consecutive Subsequences/README.md	
@@ -0,0 +1,105 @@
+---
+comments: true
+difficulty: 困难
+edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3299.Sum%20of%20Consecutive%20Subsequences/README.md
+---
+
+
+
+# [3299. Sum of Consecutive Subsequences 🔒](https://leetcode.cn/problems/sum-of-consecutive-subsequences)
+
+[English Version](/solution/3200-3299/3299.Sum%20of%20Consecutive%20Subsequences/README_EN.md)
+
+## 题目描述
+
+
+
+

We call an array arr of length n consecutive if one of the following holds:

+ +
    +
  • arr[i] - arr[i - 1] == 1 for all 1 <= i < n.
  • +
  • arr[i] - arr[i - 1] == -1 for all 1 <= i < n.
  • +
+ +

The value of an array is the sum of its elements.

+ +

For example, [3, 4, 5] is a consecutive array of value 12 and [9, 8] is another of value 17. While [3, 4, 3] and [8, 6] are not consecutive.

+ +

Given an array of integers nums, return the sum of the values of all consecutive non-empty subsequences.

+ +

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

+ +

Note that an array of length 1 is also considered consecutive.

+ +

 

+

Example 1:

+ +
+

Input: nums = [1,2]

+ +

Output: 6

+ +

Explanation:

+ +

The consecutive subsequences are: [1], [2], [1, 2].

+
+ +

Example 2:

+ +
+

Input: nums = [1,4,2,3]

+ +

Output: 31

+ +

Explanation:

+ +

The consecutive subsequences are: [1], [4], [2], [3], [1, 2], [2, 3], [4, 3], [1, 2, 3].

+
+ +

 

+

Constraints:

+ +
    +
  • 1 <= nums.length <= 105
  • +
  • 1 <= nums[i] <= 105
  • +
+ + + +## 解法 + + + +### 方法一 + + + +#### Python3 + +```python + +``` + +#### Java + +```java + +``` + +#### C++ + +```cpp + +``` + +#### Go + +```go + +``` + + + + + + diff --git a/solution/3200-3299/3299.Sum of Consecutive Subsequences/README_EN.md b/solution/3200-3299/3299.Sum of Consecutive Subsequences/README_EN.md new file mode 100644 index 0000000000000..12dc40d8eeed7 --- /dev/null +++ b/solution/3200-3299/3299.Sum of Consecutive Subsequences/README_EN.md @@ -0,0 +1,105 @@ +--- +comments: true +difficulty: Hard +edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3299.Sum%20of%20Consecutive%20Subsequences/README_EN.md +--- + + + +# [3299. Sum of Consecutive Subsequences 🔒](https://leetcode.com/problems/sum-of-consecutive-subsequences) + +[中文文档](/solution/3200-3299/3299.Sum%20of%20Consecutive%20Subsequences/README.md) + +## Description + + + +

We call an array arr of length n consecutive if one of the following holds:

+ +
    +
  • arr[i] - arr[i - 1] == 1 for all 1 <= i < n.
  • +
  • arr[i] - arr[i - 1] == -1 for all 1 <= i < n.
  • +
+ +

The value of an array is the sum of its elements.

+ +

For example, [3, 4, 5] is a consecutive array of value 12 and [9, 8] is another of value 17. While [3, 4, 3] and [8, 6] are not consecutive.

+ +

Given an array of integers nums, return the sum of the values of all consecutive non-empty subsequences.

+ +

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

+ +

Note that an array of length 1 is also considered consecutive.

+ +

 

+

Example 1:

+ +
+

Input: nums = [1,2]

+ +

Output: 6

+ +

Explanation:

+ +

The consecutive subsequences are: [1], [2], [1, 2].

+
+ +

Example 2:

+ +
+

Input: nums = [1,4,2,3]

+ +

Output: 31

+ +

Explanation:

+ +

The consecutive subsequences are: [1], [4], [2], [3], [1, 2], [2, 3], [4, 3], [1, 2, 3].

+
+ +

 

+

Constraints:

+ +
    +
  • 1 <= nums.length <= 105
  • +
  • 1 <= nums[i] <= 105
  • +
+ + + +## Solutions + + + +### Solution 1 + + + +#### Python3 + +```python + +``` + +#### Java + +```java + +``` + +#### C++ + +```cpp + +``` + +#### Go + +```go + +``` + + + + + + diff --git a/solution/README.md b/solution/README.md index 679ab18b8899d..99d12f8076f7d 100644 --- a/solution/README.md +++ b/solution/README.md @@ -3309,6 +3309,7 @@ | 3296 | [移山所需的最少秒数](/solution/3200-3299/3296.Minimum%20Number%20of%20Seconds%20to%20Make%20Mountain%20Height%20Zero/README.md) | `数组`,`数学`,`二分查找` | 中等 | 第 416 场周赛 | | 3297 | [统计重新排列后包含另一个字符串的子字符串数目 I](/solution/3200-3299/3297.Count%20Substrings%20That%20Can%20Be%20Rearranged%20to%20Contain%20a%20String%20I/README.md) | `哈希表`,`字符串`,`滑动窗口` | 中等 | 第 416 场周赛 | | 3298 | [统计重新排列后包含另一个字符串的子字符串数目 II](/solution/3200-3299/3298.Count%20Substrings%20That%20Can%20Be%20Rearranged%20to%20Contain%20a%20String%20II/README.md) | `哈希表`,`字符串`,`滑动窗口` | 困难 | 第 416 场周赛 | +| 3299 | [Sum of Consecutive Subsequences](/solution/3200-3299/3299.Sum%20of%20Consecutive%20Subsequences/README.md) | | 困难 | 🔒 | ## 版权 diff --git a/solution/README_EN.md b/solution/README_EN.md index 188c018c69288..3c60de1b44b73 100644 --- a/solution/README_EN.md +++ b/solution/README_EN.md @@ -3307,6 +3307,7 @@ Press Control + F(or Command + F on | 3296 | [Minimum Number of Seconds to Make Mountain Height Zero](/solution/3200-3299/3296.Minimum%20Number%20of%20Seconds%20to%20Make%20Mountain%20Height%20Zero/README_EN.md) | `Array`,`Math`,`Binary Search` | Medium | Weekly Contest 416 | | 3297 | [Count Substrings That Can Be Rearranged to Contain a String I](/solution/3200-3299/3297.Count%20Substrings%20That%20Can%20Be%20Rearranged%20to%20Contain%20a%20String%20I/README_EN.md) | `Hash Table`,`String`,`Sliding Window` | Medium | Weekly Contest 416 | | 3298 | [Count Substrings That Can Be Rearranged to Contain a String II](/solution/3200-3299/3298.Count%20Substrings%20That%20Can%20Be%20Rearranged%20to%20Contain%20a%20String%20II/README_EN.md) | `Hash Table`,`String`,`Sliding Window` | Hard | Weekly Contest 416 | +| 3299 | [Sum of Consecutive Subsequences](/solution/3200-3299/3299.Sum%20of%20Consecutive%20Subsequences/README_EN.md) | | Hard | 🔒 | ## Copyright