#3755

Find Maximum Balanced XOR Subarray Length

medium · 50.8% accepted · 106 likes · top 39%

array · hash table · bit manipulation · prefix sum

Description

Given an integer array nums, return the length of the longest subarray that has a bitwise XOR of zero and contains an equal number of even and odd numbers. If no such subarray exists, return 0.

Solution