For range queries on a subarray [L,R] , I want to find all the indices of successive maximums from left to right within O(log(R-L+1)), excluding index "L". I know using segment trees I can find the single maximum in given time limit.
Example if [L,R] is 20 3 10 5 10 7 6 7 5 7 5 -> the bold ones are the answers
Note
- that 20 is excluded but the first maximum i.e 10 has to be lesser than 20
- In case of multiple occurrences of a particular maximum, the rightmost index must be used
Also, there is a need for updation of array elements so an online query algorithm would be helpful!