Infosys Sp OA problem -- 2024

Revision en1, by AJAY-GOJO, 2024-08-05 18:56:32

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

Tags infosys

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English AJAY-GOJO 2024-08-05 18:56:32 721 Initial revision (published)