Count Good Subsequences
Problem Overview
- Count good subsequences in an array, where a sequence is good if all elements are unique and all integers between its min and max appear.
- Input: int array arr of size n (1 ≤ n ≤ 1e5, 1 ≤ arr[i] ≤ 1e5); Output: long integer count of distinct subsequences by indices.
- Domain: array/subsequence processing, modeling contiguous value ranges in datasets.
- This coding interview problem is from Flexport interviews and is a common interview question.
Example
Unlock to view complete problem details
and practice with sample input/output
Was this article helpful?
View Test Cases & Run Code requires membership
Input Variables
Execution Result:
