HuTao_Oya_OyaOya's blog

By HuTao_Oya_OyaOya, history, 4 hours ago, In English

Problem Link

Problem in short : Find sum of XOR of all subarrays of size>1 in the given array of size n in linear time.

My idea is to get the prefix sum array of XORs and now the problem is reduced to finding XOR between all possible pairs in prefix XOR array.

I tried for hours to debug the code but couldn't figure out what did I do wrong. Any help would be greatly appreciated.

Old Code

UPD :

AC
What was the problem earlier ?

Thanks srinivas1999 xQConqueror vaibhav2740

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

»
4 hours ago, # |
  Vote: I like it 0 Vote: I do not like it

Your approach is right but code is wrong.

»
4 hours ago, # |
  Vote: I like it +2 Vote: I do not like it

Can't you use segment tree to solve it in O(nlogn) ?

»
3 hours ago, # |
  Vote: I like it +1 Vote: I do not like it
Solution

Code from, i just subtract the sum of all subarrays of 1 element

»
2 minutes ago, # |
  Vote: I like it 0 Vote: I do not like it

no thanks to me ?