Problem Brief
Find Number of Good Subsequences π
OA
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 > jj 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.
1Example 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!
2Example 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!