In the following implementation of segment tree, in the case when number of elements in the array for the range query, say A, are n such that n is not a power of 2, then I'm unable to establish that we actually require
2 * (pow(2,ceil((log2(n)))) - 1 nodes of the segment tree.
In which case does the node variable's value in the following implementation may go past the 2*n-2 ?
https://onlinegdb.com/S1LMjFqCz (solution)
https://www.hackerearth.com/practice/data-structures/advanced-data-structures/segment-trees/practice-problems/algorithm/range-minimum-query/ (problem statement)