diff --git "a/lcof2/\345\211\221\346\214\207 Offer II 098. \350\267\257\345\276\204\347\232\204\346\225\260\347\233\256/README.md" "b/lcof2/\345\211\221\346\214\207 Offer II 098. \350\267\257\345\276\204\347\232\204\346\225\260\347\233\256/README.md" index c623ea35cd19e..403c34d0afcc8 100644 --- "a/lcof2/\345\211\221\346\214\207 Offer II 098. \350\267\257\345\276\204\347\232\204\346\225\260\347\233\256/README.md" +++ "b/lcof2/\345\211\221\346\214\207 Offer II 098. \350\267\257\345\276\204\347\232\204\346\225\260\347\233\256/README.md" @@ -254,7 +254,7 @@ class Solution { func uniquePaths(_ m: Int, _ n: Int) -> Int { var dp = Array(repeating: Array(repeating: 0, count: n), count: m) dp[0][0] = 1 - + for i in 0.. 0 { @@ -265,7 +265,7 @@ class Solution { } } } - + return dp[m - 1][n - 1] } } diff --git "a/lcof2/\345\211\221\346\214\207 Offer II 099. \346\234\200\345\260\217\350\267\257\345\276\204\344\271\213\345\222\214/README.md" "b/lcof2/\345\211\221\346\214\207 Offer II 099. \346\234\200\345\260\217\350\267\257\345\276\204\344\271\213\345\222\214/README.md" index df546c0e221a5..05596f470182f 100644 --- "a/lcof2/\345\211\221\346\214\207 Offer II 099. \346\234\200\345\260\217\350\267\257\345\276\204\344\271\213\345\222\214/README.md" +++ "b/lcof2/\345\211\221\346\214\207 Offer II 099. \346\234\200\345\260\217\350\267\257\345\276\204\344\271\213\345\222\214/README.md" @@ -214,17 +214,17 @@ class Solution { for i in 1..输出:[[2,1],[1,2]] 解释:起点为 (2,3) 。 价格范围为 [2,3] ,我们可以选择的物品坐标为 (0,1),(1,1),(1,2) 和 (2,1) 。 -这些物品的排名为: +这些物品的排名为: - (2,1) 距离为 2 ,价格为 2 - (1,2) 距离为 2 ,价格为 3 - (1,1) 距离为 3 diff --git a/solution/2100-2199/2146.K Highest Ranked Items Within a Price Range/README_EN.md b/solution/2100-2199/2146.K Highest Ranked Items Within a Price Range/README_EN.md index d52629bfa5a31..953927f1998e9 100644 --- a/solution/2100-2199/2146.K Highest Ranked Items Within a Price Range/README_EN.md +++ b/solution/2100-2199/2146.K Highest Ranked Items Within a Price Range/README_EN.md @@ -82,11 +82,11 @@ Thus, the 2 highest ranked items in the price range are (2,1) and (1,2). Input: grid = [[1,1,1],[0,0,1],[2,3,4]], pricing = [2,3], start = [0,0], k = 3 Output: [[2,1],[2,0]] Explanation: You start at (0,0). -With a price range of [2,3], we can take items from (2,0) and (2,1). -The ranks of these items are: +With a price range of [2,3], we can take items from (2,0) and (2,1). +The ranks of these items are: - (2,1) with distance 5 - (2,0) with distance 6 -Thus, the 2 highest ranked items in the price range are (2,1) and (2,0). +Thus, the 2 highest ranked items in the price range are (2,1) and (2,0). Note that k = 3 but there are only 2 reachable items within the price range. diff --git a/solution/3200-3299/3284.Sum of Consecutive Subarrays/README.md b/solution/3200-3299/3284.Sum of Consecutive Subarrays/README.md new file mode 100644 index 0000000000000..314bf9ac79758 --- /dev/null +++ b/solution/3200-3299/3284.Sum of Consecutive Subarrays/README.md @@ -0,0 +1,298 @@ +--- +comments: true +difficulty: 中等 +edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3284.Sum%20of%20Consecutive%20Subarrays/README.md +--- + + + +# [3284. Sum of Consecutive Subarrays 🔒](https://leetcode.cn/problems/sum-of-consecutive-subarrays) + +[English Version](/solution/3200-3299/3284.Sum%20of%20Consecutive%20Subarrays/README_EN.md) + +## 题目描述 + + + +

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

+ + + +

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 subarrays.

+ +

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,3]

+ +

Output: 20

+ +

Explanation:

+ +

The consecutive subarrays are: [1], [2], [3], [1, 2], [2, 3], [1, 2, 3].
+Sum of their values would be: 1 + 2 + 3 + 3 + 5 + 6 = 20.

+
+ +

Example 2:

+ +
+

Input: nums = [1,3,5,7]

+ +

Output: 16

+ +

Explanation:

+ +

The consecutive subarrays are: [1], [3], [5], [7].
+Sum of their values would be: 1 + 3 + 5 + 7 = 16.

+
+ +

Example 3:

+ +
+

Input: nums = [7,6,1,2]

+ +

Output: 32

+ +

Explanation:

+ +

The consecutive subarrays are: [7], [6], [1], [2], [7, 6], [1, 2].
+Sum of their values would be: 7 + 6 + 1 + 2 + 13 + 3 = 32.

+
+ +

 

+

Constraints:

+ + + + + +## 解法 + + + +### 方法一:递推 + +我们定义两个变量 $f$ 和 $g$,分别表示以当前元素结尾的递增子数组的长度和以当前元素结尾的递减子数组的长度,用另外两个变量 $s$ 和 $t$ 分别表示以当前元素结尾的递增子数组的和和以当前元素结尾的递减子数组的和。初始时 $f = g = 1$,而 $s = t = \textit{nums}[0]$。 + +接下来,我们从第二个元素开始遍历数组,对于当前元素 $\textit{nums}[i]$,我们分别考虑以 $\textit{nums}[i]$ 结尾的递增子数组和递减子数组。 + +如果 $\textit{nums}[i] - \textit{nums}[i - 1] = 1$,那么 $\textit{nums}[i]$ 可以加入到以 $\textit{nums}[i - 1]$ 结尾的递增子数组中,此时我们更新 $f$ 和 $s$,并将 $s$ 加到答案中; + +如果 $\textit{nums}[i] - \textit{nums}[i - 1] = -1$,那么 $\textit{nums}[i]$ 可以加入到以 $\textit{nums}[i - 1]$ 结尾的递减子数组中,此时我们更新 $g$ 和 $t$,并将 $t$ 加到答案中。 + +否则,$\textit{nums}[i]$ 无法加入到以 $\textit{nums}[i - 1]$ 结尾的递增子数组或递减子数组中,我们将 $\textit{nums}[i]$ 加到答案中。 + +遍历结束后,返回答案即可。 + +时间复杂度 $O(n)$,其中 $n$ 是数组的长度。空间复杂度 $O(1)$。 + + + +#### Python3 + +```python +class Solution: + def getSum(self, nums: List[int]) -> int: + mod = 10**9 + 7 + f = g = 1 + s = t = nums[0] + ans = nums[0] + for x, y in pairwise(nums): + if y - x == 1: + f += 1 + s += f * y + ans = (ans + s) % mod + else: + f = 1 + s = y + if y - x == -1: + g += 1 + t += g * y + ans = (ans + t) % mod + else: + g = 1 + t = y + if abs(y - x) != 1: + ans = (ans + y) % mod + return ans +``` + +#### Java + +```java +class Solution { + public int getSum(int[] nums) { + final int mod = (int) 1e9 + 7; + long s = nums[0], t = nums[0], ans = nums[0]; + int f = 1, g = 1; + for (int i = 1; i < nums.length; ++i) { + int x = nums[i - 1], y = nums[i]; + if (y - x == 1) { + ++f; + s += 1L * f * y; + ans = (ans + s) % mod; + } else { + f = 1; + s = y; + } + if (y - x == -1) { + ++g; + t += 1L * g * y; + ans = (ans + t) % mod; + } else { + g = 1; + t = y; + } + if (Math.abs(y - x) != 1) { + ans = (ans + y) % mod; + } + } + return (int) ans; + } +} +``` + +#### C++ + +```cpp +class Solution { +public: + int getSum(vector& nums) { + const int mod = 1e9 + 7; + long long s = nums[0], t = nums[0], ans = nums[0]; + int f = 1, g = 1; + for (int i = 1; i < nums.size(); ++i) { + int x = nums[i - 1], y = nums[i]; + if (y - x == 1) { + ++f; + s += 1LL * f * y; + ans = (ans + s) % mod; + } else { + f = 1; + s = y; + } + if (y - x == -1) { + ++g; + t += 1LL * g * y; + ans = (ans + t) % mod; + } else { + g = 1; + t = y; + } + if (abs(y - x) != 1) { + ans = (ans + y) % mod; + } + } + return ans; + } +}; +``` + +#### Go + +```go +func getSum(nums []int) int { + const mod int = 1e9 + 7 + f, g := 1, 1 + s, t := nums[0], nums[0] + ans := nums[0] + + for i := 1; i < len(nums); i++ { + x, y := nums[i-1], nums[i] + + if y-x == 1 { + f++ + s += f * y + ans = (ans + s) % mod + } else { + f = 1 + s = y + } + + if y-x == -1 { + g++ + t += g * y + ans = (ans + t) % mod + } else { + g = 1 + t = y + } + + if abs(y-x) != 1 { + ans = (ans + y) % mod + } + } + + return ans +} + +func abs(x int) int { + if x < 0 { + return -x + } + return x +} +``` + +#### TypeScript + +```ts +function getSum(nums: number[]): number { + const mod = 10 ** 9 + 7; + let f = 1, + g = 1; + let s = nums[0], + t = nums[0]; + let ans = nums[0]; + + for (let i = 1; i < nums.length; i++) { + const x = nums[i - 1]; + const y = nums[i]; + + if (y - x === 1) { + f++; + s += f * y; + ans = (ans + s) % mod; + } else { + f = 1; + s = y; + } + + if (y - x === -1) { + g++; + t += g * y; + ans = (ans + t) % mod; + } else { + g = 1; + t = y; + } + + if (Math.abs(y - x) !== 1) { + ans = (ans + y) % mod; + } + } + + return ans; +} +``` + + + + + + diff --git a/solution/3200-3299/3284.Sum of Consecutive Subarrays/README_EN.md b/solution/3200-3299/3284.Sum of Consecutive Subarrays/README_EN.md new file mode 100644 index 0000000000000..81f511a6677ea --- /dev/null +++ b/solution/3200-3299/3284.Sum of Consecutive Subarrays/README_EN.md @@ -0,0 +1,298 @@ +--- +comments: true +difficulty: Medium +edit_url: https://github.com/doocs/leetcode/edit/main/solution/3200-3299/3284.Sum%20of%20Consecutive%20Subarrays/README_EN.md +--- + + + +# [3284. Sum of Consecutive Subarrays 🔒](https://leetcode.com/problems/sum-of-consecutive-subarrays) + +[中文文档](/solution/3200-3299/3284.Sum%20of%20Consecutive%20Subarrays/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 subarrays.

+ +

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,3]

+ +

Output: 20

+ +

Explanation:

+ +

The consecutive subarrays are: [1], [2], [3], [1, 2], [2, 3], [1, 2, 3].
+Sum of their values would be: 1 + 2 + 3 + 3 + 5 + 6 = 20.

+
+ +

Example 2:

+ +
+

Input: nums = [1,3,5,7]

+ +

Output: 16

+ +

Explanation:

+ +

The consecutive subarrays are: [1], [3], [5], [7].
+Sum of their values would be: 1 + 3 + 5 + 7 = 16.

+
+ +

Example 3:

+ +
+

Input: nums = [7,6,1,2]

+ +

Output: 32

+ +

Explanation:

+ +

The consecutive subarrays are: [7], [6], [1], [2], [7, 6], [1, 2].
+Sum of their values would be: 7 + 6 + 1 + 2 + 13 + 3 = 32.

+
+ +

 

+

Constraints:

+ +
    +
  • 1 <= nums.length <= 105
  • +
  • 1 <= nums[i] <= 105
  • +
+ + + +## Solutions + + + +### Solution 1: Recurrence + +We define two variables $f$ and $g$, representing the length of the increasing subarray ending at the current element and the length of the decreasing subarray ending at the current element, respectively. We use two other variables $s$ and $t$ to represent the sum of the increasing subarray ending at the current element and the sum of the decreasing subarray ending at the current element, respectively. Initially, $f = g = 1$, and $s = t = \textit{nums}[0]$. + +Next, we traverse the array starting from the second element. For the current element $\textit{nums}[i]$, we consider the increasing subarray and the decreasing subarray ending at $\textit{nums}[i]$. + +If $\textit{nums}[i] - \textit{nums}[i - 1] = 1$, then $\textit{nums}[i]$ can be added to the increasing subarray ending at $\textit{nums}[i - 1]$. In this case, we update $f$ and $s$, and add $s$ to the answer. + +If $\textit{nums}[i] - \textit{nums}[i - 1] = -1$, then $\textit{nums}[i]$ can be added to the decreasing subarray ending at $\textit{nums}[i - 1]$. In this case, we update $g$ and $t$, and add $t$ to the answer. + +Otherwise, $\textit{nums}[i]$ cannot be added to the increasing or decreasing subarray ending at $\textit{nums}[i - 1]$. We add $\textit{nums}[i]$ to the answer. + +After the traversal, return the answer. + +The time complexity is $O(n)$, where $n$ is the length of the array. The space complexity is $O(1)$. + + + +#### Python3 + +```python +class Solution: + def getSum(self, nums: List[int]) -> int: + mod = 10**9 + 7 + f = g = 1 + s = t = nums[0] + ans = nums[0] + for x, y in pairwise(nums): + if y - x == 1: + f += 1 + s += f * y + ans = (ans + s) % mod + else: + f = 1 + s = y + if y - x == -1: + g += 1 + t += g * y + ans = (ans + t) % mod + else: + g = 1 + t = y + if abs(y - x) != 1: + ans = (ans + y) % mod + return ans +``` + +#### Java + +```java +class Solution { + public int getSum(int[] nums) { + final int mod = (int) 1e9 + 7; + long s = nums[0], t = nums[0], ans = nums[0]; + int f = 1, g = 1; + for (int i = 1; i < nums.length; ++i) { + int x = nums[i - 1], y = nums[i]; + if (y - x == 1) { + ++f; + s += 1L * f * y; + ans = (ans + s) % mod; + } else { + f = 1; + s = y; + } + if (y - x == -1) { + ++g; + t += 1L * g * y; + ans = (ans + t) % mod; + } else { + g = 1; + t = y; + } + if (Math.abs(y - x) != 1) { + ans = (ans + y) % mod; + } + } + return (int) ans; + } +} +``` + +#### C++ + +```cpp +class Solution { +public: + int getSum(vector& nums) { + const int mod = 1e9 + 7; + long long s = nums[0], t = nums[0], ans = nums[0]; + int f = 1, g = 1; + for (int i = 1; i < nums.size(); ++i) { + int x = nums[i - 1], y = nums[i]; + if (y - x == 1) { + ++f; + s += 1LL * f * y; + ans = (ans + s) % mod; + } else { + f = 1; + s = y; + } + if (y - x == -1) { + ++g; + t += 1LL * g * y; + ans = (ans + t) % mod; + } else { + g = 1; + t = y; + } + if (abs(y - x) != 1) { + ans = (ans + y) % mod; + } + } + return ans; + } +}; +``` + +#### Go + +```go +func getSum(nums []int) int { + const mod int = 1e9 + 7 + f, g := 1, 1 + s, t := nums[0], nums[0] + ans := nums[0] + + for i := 1; i < len(nums); i++ { + x, y := nums[i-1], nums[i] + + if y-x == 1 { + f++ + s += f * y + ans = (ans + s) % mod + } else { + f = 1 + s = y + } + + if y-x == -1 { + g++ + t += g * y + ans = (ans + t) % mod + } else { + g = 1 + t = y + } + + if abs(y-x) != 1 { + ans = (ans + y) % mod + } + } + + return ans +} + +func abs(x int) int { + if x < 0 { + return -x + } + return x +} +``` + +#### TypeScript + +```ts +function getSum(nums: number[]): number { + const mod = 10 ** 9 + 7; + let f = 1, + g = 1; + let s = nums[0], + t = nums[0]; + let ans = nums[0]; + + for (let i = 1; i < nums.length; i++) { + const x = nums[i - 1]; + const y = nums[i]; + + if (y - x === 1) { + f++; + s += f * y; + ans = (ans + s) % mod; + } else { + f = 1; + s = y; + } + + if (y - x === -1) { + g++; + t += g * y; + ans = (ans + t) % mod; + } else { + g = 1; + t = y; + } + + if (Math.abs(y - x) !== 1) { + ans = (ans + y) % mod; + } + } + + return ans; +} +``` + + + + + + diff --git a/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.cpp b/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.cpp new file mode 100644 index 0000000000000..f2ede1bfc0380 --- /dev/null +++ b/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.cpp @@ -0,0 +1,31 @@ +class Solution { +public: + int getSum(vector& nums) { + const int mod = 1e9 + 7; + long long s = nums[0], t = nums[0], ans = nums[0]; + int f = 1, g = 1; + for (int i = 1; i < nums.size(); ++i) { + int x = nums[i - 1], y = nums[i]; + if (y - x == 1) { + ++f; + s += 1LL * f * y; + ans = (ans + s) % mod; + } else { + f = 1; + s = y; + } + if (y - x == -1) { + ++g; + t += 1LL * g * y; + ans = (ans + t) % mod; + } else { + g = 1; + t = y; + } + if (abs(y - x) != 1) { + ans = (ans + y) % mod; + } + } + return ans; + } +}; diff --git a/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.go b/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.go new file mode 100644 index 0000000000000..75f4b1847c6e0 --- /dev/null +++ b/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.go @@ -0,0 +1,41 @@ +func getSum(nums []int) int { + const mod int = 1e9 + 7 + f, g := 1, 1 + s, t := nums[0], nums[0] + ans := nums[0] + + for i := 1; i < len(nums); i++ { + x, y := nums[i-1], nums[i] + + if y-x == 1 { + f++ + s += f * y + ans = (ans + s) % mod + } else { + f = 1 + s = y + } + + if y-x == -1 { + g++ + t += g * y + ans = (ans + t) % mod + } else { + g = 1 + t = y + } + + if abs(y-x) != 1 { + ans = (ans + y) % mod + } + } + + return ans +} + +func abs(x int) int { + if x < 0 { + return -x + } + return x +} diff --git a/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.java b/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.java new file mode 100644 index 0000000000000..aa41f6e0a1e83 --- /dev/null +++ b/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.java @@ -0,0 +1,30 @@ +class Solution { + public int getSum(int[] nums) { + final int mod = (int) 1e9 + 7; + long s = nums[0], t = nums[0], ans = nums[0]; + int f = 1, g = 1; + for (int i = 1; i < nums.length; ++i) { + int x = nums[i - 1], y = nums[i]; + if (y - x == 1) { + ++f; + s += 1L * f * y; + ans = (ans + s) % mod; + } else { + f = 1; + s = y; + } + if (y - x == -1) { + ++g; + t += 1L * g * y; + ans = (ans + t) % mod; + } else { + g = 1; + t = y; + } + if (Math.abs(y - x) != 1) { + ans = (ans + y) % mod; + } + } + return (int) ans; + } +} diff --git a/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.py b/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.py new file mode 100644 index 0000000000000..93fe3db15fa05 --- /dev/null +++ b/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.py @@ -0,0 +1,24 @@ +class Solution: + def getSum(self, nums: List[int]) -> int: + mod = 10**9 + 7 + f = g = 1 + s = t = nums[0] + ans = nums[0] + for x, y in pairwise(nums): + if y - x == 1: + f += 1 + s += f * y + ans = (ans + s) % mod + else: + f = 1 + s = y + if y - x == -1: + g += 1 + t += g * y + ans = (ans + t) % mod + else: + g = 1 + t = y + if abs(y - x) != 1: + ans = (ans + y) % mod + return ans diff --git a/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.ts b/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.ts new file mode 100644 index 0000000000000..e1707129b12c3 --- /dev/null +++ b/solution/3200-3299/3284.Sum of Consecutive Subarrays/Solution.ts @@ -0,0 +1,37 @@ +function getSum(nums: number[]): number { + const mod = 10 ** 9 + 7; + let f = 1, + g = 1; + let s = nums[0], + t = nums[0]; + let ans = nums[0]; + + for (let i = 1; i < nums.length; i++) { + const x = nums[i - 1]; + const y = nums[i]; + + if (y - x === 1) { + f++; + s += f * y; + ans = (ans + s) % mod; + } else { + f = 1; + s = y; + } + + if (y - x === -1) { + g++; + t += g * y; + ans = (ans + t) % mod; + } else { + g = 1; + t = y; + } + + if (Math.abs(y - x) !== 1) { + ans = (ans + y) % mod; + } + } + + return ans; +} diff --git a/solution/README.md b/solution/README.md index e0fac4e46dd01..aa4b2101a340f 100644 --- a/solution/README.md +++ b/solution/README.md @@ -3294,6 +3294,7 @@ | 3281 | [范围内整数的最大得分](/solution/3200-3299/3281.Maximize%20Score%20of%20Numbers%20in%20Ranges/README.md) | `贪心`,`数组`,`二分查找`,`排序` | 中等 | 第 414 场周赛 | | 3282 | [到达数组末尾的最大得分](/solution/3200-3299/3282.Reach%20End%20of%20Array%20With%20Max%20Score/README.md) | `贪心`,`数组` | 中等 | 第 414 场周赛 | | 3283 | [吃掉所有兵需要的最多移动次数](/solution/3200-3299/3283.Maximum%20Number%20of%20Moves%20to%20Kill%20All%20Pawns/README.md) | `位运算`,`广度优先搜索`,`数组`,`数学`,`状态压缩`,`博弈` | 困难 | 第 414 场周赛 | +| 3284 | [Sum of Consecutive Subarrays](/solution/3200-3299/3284.Sum%20of%20Consecutive%20Subarrays/README.md) | | 中等 | 🔒 | ## 版权 diff --git a/solution/README_EN.md b/solution/README_EN.md index 8a87a205c08db..a6cb76f4edbb6 100644 --- a/solution/README_EN.md +++ b/solution/README_EN.md @@ -3292,6 +3292,7 @@ Press Control + F(or Command + F on | 3281 | [Maximize Score of Numbers in Ranges](/solution/3200-3299/3281.Maximize%20Score%20of%20Numbers%20in%20Ranges/README_EN.md) | `Greedy`,`Array`,`Binary Search`,`Sorting` | Medium | Weekly Contest 414 | | 3282 | [Reach End of Array With Max Score](/solution/3200-3299/3282.Reach%20End%20of%20Array%20With%20Max%20Score/README_EN.md) | `Greedy`,`Array` | Medium | Weekly Contest 414 | | 3283 | [Maximum Number of Moves to Kill All Pawns](/solution/3200-3299/3283.Maximum%20Number%20of%20Moves%20to%20Kill%20All%20Pawns/README_EN.md) | `Bit Manipulation`,`Breadth-First Search`,`Array`,`Math`,`Bitmask`,`Game Theory` | Hard | Weekly Contest 414 | +| 3284 | [Sum of Consecutive Subarrays](/solution/3200-3299/3284.Sum%20of%20Consecutive%20Subarrays/README_EN.md) | | Medium | 🔒 | ## Copyright