
| height[i] - height[i+1] | <= K, where i ∈ (1, N-1)
Positions are counted starting from 0.
If two or more students have height equal to 'H', return the student with the minimum position.
The first line contains 'T', denoting the number of tests.
For each Test :
The first line contains three space-separated integers 'N', 'K' and 'H', denoting the number of students, the maximum difference in adjacent heights, and height of target student, respectively.
The second line contains an array 'A' of length 'N', denoting the heights of students.
For each test, print an integer, denoting the minimum position of a student having a height equal to 'H'.
You are not required to print the expected output. It has already been taken care of. Just implement the function.
1 <= 'T' <= 5
1 <= 'N' <= 10^5
1 <= K, A[i] <= 10^9 i ∈ (1, N)
Note - Sum of 'N' over all test cases does not exceed 10^5.
Time Limit: 1 sec
Algorithm:
Calculate the difference between 'H' and A[i] for each position, let it be 'diff'. Using the above observation, from position 'i', we can directly jump to i + (diff / K).
Algorithm: