Round 1
Questions:
You will be given an array A of size N.
Find the number of sub-sequences (not necessarily of consecutive elements) that meet the following conditions:
- If the element x appears in the sub-sequence then all appearances of x are consecutive in the taken sub-sequence.
- Two sub-sequences X, Y are different if there is an index i that is taken in X but not taken in Y or taken in Y but not taken in X.
Return the answer modulo 998244353.
Input:
- The first line contains an integer, N denoting the number of elements in A.
- Each line i of the N subsequent lines (where 0 < i < N) contains an integer describing A[i].
Constraints:
- 1 <= N <= 10^3
- 0 <= A[i] <= 8
Sample Input:
2 1 2
Output: 3
Sample Input:
3 1 2 1
Output: 6
Sample Input:
4 1 2 3 4
Output: 15
Candidate's Approach
No approach provided.
Interviewer's Feedback
No feedback provided.