Leetcode 1442. Count Triplets That Can Form Two Arrays of Equal XOR
Count the number of triplets (i, j, k) with 0 ≤ i < j ≤ k < n such that the XOR of arr[i..j-1] equals the XOR of arr[j..k]; this reduces to finding pairs of equal prefix-xor values because a == b iff prefixXOR[i] == prefixXOR[k+1], and each such pair contributes as many valid j positions as the gap between them.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
0
Hello Interview Premium
Your account is free and you can post anonymously if you choose.