Given a sorted array A of n elements. We are given n queries of the type [l, r] where l and r are the indices. 0 <= l , r < n In each query, we have to find out the mode in the range [l,r] both inclusive. We can use no more than n * log(n) memory and the solution should run in n * log(n) time.
Can we do it in given constraints on memory and time?







