You are given an array \(A\) of length \(N\). A subsequence is called good if all the elements of that subsequence are distinct. Find the number of non-empty good subsequences modulo \(10^9+7\).
Two subsequences are different if they differ in the indices chosen.
Input Format:
- The first line contains an integer \(T\), which denotes the number of test cases.
- The first line of each test case contains an integer \(N\).
- The second line of each test case contains \(N\) space-separated integers, elements of array \(A\).
Output Format:
For each test case, print the number of non-empty good subsequences modulo \(10^9+7\).
Constraints:
First test case:
Good subsequences are \([2], [3], [1], [2, 3], [2, 1], [3, 1], [2, 3, 1]\). Hence, the answer is \(7\).
Second test case:
Good subsequences are \( [1], [1], [1], [1]\). Hence, the answer is \(4\).
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor
Login to unlock the editorial
Please login to use the editor
You need to be logged in to access the code editor
Loading...
Please wait while we load the editor