Good Subsequence
Practice
4.5 (2 votes)
Math
Observation
Basic math
C++
Problem
22% Success 417 Attempts 20 Points 1s Time Limit 256MB Memory 1024 KB Max Code

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:

\(1 \leq T \leq 10 \\ 1 \leq N \leq 10^5 \\ 1 \leq A[i] \leq 10^5\)

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

Loading...
Results
Custom Input
Run your code to see the output
Submissions
Please login to view your submissions
Similar Problems
Points:20
19 votes
Tags:
Basic MathAlgorithmsMath
Points:20
27 votes
Tags:
Brute-force searchMathematicsApprovedEasy
Points:20
111 votes
Tags:
MathematicsEasyMathematicsMathamatics