Tap here to switch tabs
Problem
Submissions

Problem: Sum of Good Subsequences

med
30 min
Try to solve the Sum of Good Subsequences problem.

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

med
30 min
Try to solve the Sum of Good Subsequences problem.

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