infosysOA #2
Find Number of Good Subsequences
估计困难评测数据准备中,可先阅读题面
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):
Choose two adjacent elements i and j such that i > j
Remove 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 10⁹ +7.
Constraints
N/A
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!