This is a simple and efficient C++ implementation of Range Minimum Query(RMQ) using Sparse Table .
Input :
8
4 6 5 2 3 4 9 1
1 3
2 5
3 6
Here,
1st line of input is the number of elements .
2nd line of input is those elements.
3rd to 5th line of input is the query.