AJAY-GOJO's blog

By AJAY-GOJO, history, 7 hours ago, In English

frequency problem

you have two function defined as follows: --> frequency (left,right,val) : return the number of element in the range [left,right] that are equal to value --> distinct (left,right): return the number of distinct element in range[left,right]

find the number of pair(i,j) the satisfy the following conditions: freuqncy(1,i,A[i]) + freuency(j,N,A[J]) <= L distinct(1,i)/2 L + L distinct(j,N)/2 L . since answer can be very large return it modulo 10^9+7.

note L X L represent the greatest integer less than or equal to x . 1<=i<j<= N

can anyone give me apporach of this mine give TLE.

test case 1 N = 5 A = 2,2,3,1,5

test case 2 N= 5 A = 5,5,5,5,5

Full text and comments »

  • Vote: I like it
  • -1
  • Vote: I do not like it