Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
A subarray is beautiful if its xor is equal to zero.
Compute the prefix xor for every index, then the xor of subarray [left, right] is equal to zero if prefix_xor[left] ^ perfix_xor[right] == 0
Iterate from left to right and maintain a hash table to count the number of indices equal to the current prefix xor.