Range Minimum Query is used on arrays to find the position of an element with the minimum value between two specified indices. This problem can be solved in many different ways, such as dynamic programming, segment tree, ect. Here shows the C++ implementation of so-called sparse table algorithm.
The file output: