There was a question in my tiktok oa which was of this sort - Find the number of subarrays of length atleast 3 such that the bitwise XOR of the first and the last elements of the subarray is equal to the bitwise XOR of all the other elements in the subarray.
Example: [0,3,6,5]
Ans: 2
Solution: [3,6,5] and [0,3,6,5] would be considered, and hence the answer is 2.
Approach: I thought of brute force and prefix sum, but none are better than O(n2). My approaches passed only 8/15. Any thoughts what kind of approach would work?