Array contains atmost 10^7 elements. Is there any way we can find the min value within range in O(1) time as number of queries will be atmost 10^7.
Sparse tables achieve Range Minimum Queries(RMQ) in O(1) time per query and O(NlogN) space and a precomputation time of O(NlogN).
Nice explanation can be found here: