Range update queries for finding the frequency | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Range update queries for finding the frequency

How to find out frequency of all the elements in array till 1 to y , array has total N elements(1<= y<= N).where the array is continuously updating its one value at a time. I got time out in this question. And we have to answer upto 100000 queries. In each query either there will be update in array or we have to find out the frequency till 1 to y

18th Mar 2019, 7:01 AM
Jaydeep Machhi
Jaydeep Machhi - avatar
1 Answer
+ 1
~ swim ~ Thanks for your answer but the questions is a bit different we have to answer for q queries initially the array is initialised with all zeros and in the queries there will be update in array atmost in one element everytime and after it we have to find multiplication of all the elements' p , (Freq[p]+1)^(Freq ([p]+1) mod (10^9 + 7) so I can use Euclidean moduler multiplication to find it but I don't know how to find multiplication mod but how to find frequency of subarray 1 to y in less than O(n) time?
18th Mar 2019, 8:31 AM
Jaydeep Machhi
Jaydeep Machhi - avatar