Company: grow_25sep
Difficulty: medium
Good Subsequences Problem Description An array A has N elements a1, a2, ..., aN . A subsequence of the array is called good if the bitwise OR of all the elements present in that subsequence is exactly K . Find the maximum sum of all the indices of the elements present in a good subsequence. If the array has no good subsequence, print -1 . (inferred -- the source does not say what to print when no good subsequence exists; its code template only starts the result at a placeholder value of -404, so -1 is used.) A subsequence is a sequence that can be derived from the array by removing zero or more elements, without changing the order of the remaining elements. Indices are 1-based. Function Description Complete the function goodSubsequence in the editor. It has the following parameters: int N : the number of elements in the array int K : the required bitwise OR value int A[N] : the elements of the array ( A[0] is the element at index 1) It returns an int : the maximum sum of the 1-based in