Блог пользователя prabal_1997

Автор prabal_1997, история, 6 лет назад, По-английски

question goes like this.... given an array of n nos.and queries q the queries follow like this given range l to r (l<=r) for every query we have to find sum of elements which have an odd frequency in the given range

note : 1 based indexing is followed.............................................................................................

example : 5......n

1 2 2 2 1....elements

3..queries...

1 3...

1 4......

1 5......

output: 1..... 7..... 6.....

explanation : 1. in range 1 to 3 only 1 has odd frequecy i.e 1 so ans =1 !!! 2.in range 1 to 4 1 has frequency 1 and 2 has frequecy 3 so ans = 1*1 + 2*3 = 6 !!!

I am not able to solve this......question if time limit is 1 second.

Полный текст и комментарии »

  • Проголосовать: нравится
  • -19
  • Проголосовать: не нравится