+ 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
3 ответов
+ 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?