

Let,
ARR = [2, 1, 4, 3]
X = 2 , Y = 3
Answer:- 3 (The sub-arrays which meet the requirements are [2], [2, 1], [3]).
The first line contains a single integer ‘T’ representing the number of test cases. Then each test case follows.
The first line of each test case contains three integers ‘N’, ‘X’, and ‘Y’ denoting the length of the array given and the two integers.
The next line of every test case contains ‘N’ integers containing the elements of the array arr.
For each test case, print an integer denoting the number of sub-arrays that has a maximum between X and Y.
The output of each test case should be printed in a separate line.
You are not required to print anything, it has already been taken care of. Just implement the function.
1 <= T <= 5
4 <= N <= 10^5
1 <= ARR[i] <= 10^9
Time Limit: 1 sec
Fix the starting and ending points of the sub-array and check whether the maximum of this array lies in the range or not.
We can find out the no of sub-arrays with the ith element as its maximum. The number of sub-arrays with the ith element as its maximum will be the subarrays with starting position between i and prev[i] + 1 and ending position between i and nex[i] - 1 where prev[i] is the index of the previous greater number and nex[i] is the index of the next greater number.