in problem 459d we have to find the i,j pairs for which f(1,i,a[i]) > f(j,n,a[j]])
we will first count left[i] i.e frequency of a[i] in the range [1,i] and r[i] i.e freq. of a[i] from [i,n] .
after that what to do .. how to solve it in O(n) time ..
please help !