Tap here to switch tabs
Problem
Submissions

Problem: Sum of Good Subsequences

Given an integer array, Sum of Good Subsequences asks for the sum of elements in subsequences where consecutive values have an absolute difference of one, modulo a large prime.

Statement

Given an integer array nums, a subsequence is defined as a good subsequence if the absolute difference between every pair of consecutive elements in the subsequence is exactly 11.

Return the total sum of all elements across all possible good subsequences of nums. Since the answer may be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤105\leq 10^5

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Sum of Good Subsequences

Given an integer array, Sum of Good Subsequences asks for the sum of elements in subsequences where consecutive values have an absolute difference of one, modulo a large prime.

Statement

Given an integer array nums, a subsequence is defined as a good subsequence if the absolute difference between every pair of consecutive elements in the subsequence is exactly 11.

Return the total sum of all elements across all possible good subsequences of nums. Since the answer may be very large, return it modulo 109+710^9 + 7.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤105\leq 10^5