Description
Solutions
Find Number of Good Subsequences 🍅
đź“šRELATED PROBLEMS
It is given that an array A
of length N
can be called removable, if it can be turned into an array containing one element by performing the following operations some number of times (possibly zero):
i
and j
such that i > j
j
from A
, and add j
to i
Here i
and j
are values not indices.
We say that an array is good, if all its subarrays are removable.
Find the number of good subsequences in a
. Since answer can be large, return it modulo 109 +7
.
Example 1:
Input: A = [2, 4, 2, 2]
Output: 9
Explanation:No explanation for now. If you happen to know about it. Pls feel free to lmk! Many thanks in advance!
Example 2:
Input: A = [1, 2, 3]
Output: 6
Explanation:No explanation for now. If you happen to know about it. Pls feel free to lmk! Many thanks in advance!
Constraints:
N/A

Related Problems
Testcase
Result
Case 1
input:
output: