Company: Salesforce_26july
Difficulty: medium
Count Good Subsequences Problem Description A sequence is considered "good" if: All elements in the sequence are unique. If the minimum element is a and the maximum element is b , then all numbers in the range [a, b] are present in the sequence. A subsequence is derived from an array by deleting some or no elements without changing the order of the remaining elements. Two subsequences are considered different if they include at least one different index. Count the number of different good subsequences in an array. Function Description Complete the function countGoodSubsequences in the editor below. countGoodSubsequences has the following parameter: int arr[n] : the given array of integers Returns long_int : the number of good subsequences that can be derived from the array Examples Example 1: Input: arr = [3, 1, 1, 4, 12, 5, 4] The good subsequences are: Length 1: [1], [3], [4], [5], [12] (5 subsequences) Length 2: [1, 3], [1, 4], [1, 5], [1, 12], [3, 4], [4, 5] (6 subsequences) Length