Tap here to switch tabs
Problem
Submissions

Problem: Find Maximum Balanced XOR Subarray Length

Try to solve the Find Maximum Balanced XOR Subarray Length problem.

Statement

Given an integer array nums, find the maximum length of a contiguous subarray that satisfies the following two conditions:

  1. The bitwise XOR sum of all elements in the subarray is equal to 00.

  2. The subarray contains an equal count of even numbers and odd numbers.

Return the maximum length of such a subarray. If no such subarray exists, return 00.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Find Maximum Balanced XOR Subarray Length

Try to solve the Find Maximum Balanced XOR Subarray Length problem.

Statement

Given an integer array nums, find the maximum length of a contiguous subarray that satisfies the following two conditions:

  1. The bitwise XOR sum of all elements in the subarray is equal to 00.

  2. The subarray contains an equal count of even numbers and odd numbers.

Return the maximum length of such a subarray. If no such subarray exists, return 00.

Constraints:

  • 1≤1 \leq nums.length ≤105\leq 10^5

  • 0≤0 \leq nums[i] ≤109\leq 10^9