Hey guys! I was doing a question and got an idea of this interesting question.
You are given an n size array a. The ith element of array a[i] is the frequency of the element. You are given q queries which has inputs left limit l and right limit r. You have to tell the median for the range.
4 7 9 1 2
Share your approaches in the comments. I don't if this is already a question on some online judge.