Can anyone help regarding the problem asked in hackerearth hiring challenge (challenge closed now), problem statement is as follows -
You are given the following:
- An array A consisting of N positive integers
- Q queries of the form L, R, M
In each query, consider the array B = (A[L], A[L+1], A[L+2],…, A[R]) which means B is a subarray of A and contains elements of A present between the indices L and R. Consider all subsequences of this array B of size M.
Task
Determine the sum of Bitwise OR of all these subsequences. Bitwise OR of the empty subsequence is 0. If there is no subsequence of length M, print 0.