Problem
Given a binary arraynums, return the maximum length of a contiguous subarray with an equal number of 0 and 1.
Examples
Constraints
1 <= nums.length <= 10^5nums[i]is either0or1.
Tested Python solution for LeetCode 525 with 17 pytest cases. Generate a practice environment with lcpy.
nums, return the maximum length of a contiguous subarray with an equal number of 0 and 1.
1 <= nums.length <= 10^5nums[i] is either 0 or 1.