I have a problem which after some modifications reduces to "Finding the least index of number greater than x in a range[l, r] "
For example: Suppose an array A = {1, 2, 3, 6, 9, 8, 4, 3, 7, 6, 2}
And the query is "find least index of element in array A in range [2, 6] which is greater or equal to 5"
Answer for the above query is 4(value for this index is 6)(Indices are 1 based)
There are multiple queries, array is not sorted(consider that input is already in memory)
Is there an algorithm in which query is possible in O(logN) where N is no. of elements in array A.