1

How can I find the number of subarrays where bitwise XOR of the element of the subarray has odd number of set bits.

Basically I need to find the solution in linear time. I could solve in O(N^2).

What concept is required to solve this problem?

LarsTech
  • 80,625
  • 14
  • 153
  • 225
  • If you understand how to use a [prefix sum](https://en.wikipedia.org/wiki/Prefix_sum) to solve the analogous problem with addition, perhaps a similar solution exists for bitwise xor. – Matt Jun 16 '23 at 19:24
  • i think it is a question from a live contest. You should ask this after ending of contest. If i am right. – Lalit Verma Jun 19 '23 at 12:13

0 Answers0