RithwikG's picture
initial commit
7a8878c
raw
history blame contribute delete
424 Bytes
Bakry got bored of solving problems related to xor, so he asked you to solve this problem for him.You are given an array a of n integers [a1,a2,…,an].Let's call a subarray al,al+1,al+2,…,ar good if al&al+1&al+2…&ar>al⊕al+1⊕al+2…⊕ar, where ⊕ denotes the bitwise XOR operation and & denotes the bitwise AND operation.Find the length of the longest good subarray of a, or determine that no such subarray exists.