 Range Minimum Query
Medium Accuracy: 56.64% Submissions: 3865 Points: 4

Given an array A[ ] and its size N your task is to complete two functions  a constructST  function which builds the segment tree  and a function RMQ which finds range minimum query in a segment tree .

Input:
The task is to complete two functions constructST and RMQ .
The constructST function builds the segment tree and takes two arguments the array A[ ] and the size of the array .
It returns a pointer to the first element of the segment tree array .
The RMQ function takes 4 arguments the first being the segment tree st constructed, second being the size N and then third and forth arguments are the range of query a and b .The function RMQ returns the min of the elements in the array from index range a and b. There are multiple test cases. For each test case, this method will be called individually.

Output:
The function RMQ should return the min element in the array from range a to b .

Constraints:
1<=T<=100
1<=N<=10^3+1
1<=Q(no of queries)<=10000
0<=a<=b
Example:
Input (To be used only for expected output)

1
4
1 2 3 4
2
0 2 2 3

Output
1 3

Explanation
1.
For query 1 ie 0 2 the element in this range are 1 2 3 and the min element is 1
2. For query 2 ie 2 3 the element in this range are 3 4 and the min element is 3

We are replacing the old Disqus forum with the new Discussions section given below.

### Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

#### My Submissions:  